Skip to content
SubNode Code Tool w...
 
Notifications
Clear all

SubNode Code Tool with AI Agent Error: Expected String but Received Object

13 Posts
4 Users
0 Reactions
6 Views
Juan_Pablo_Sanchez
(@juan_pablo_sanchez)
Posts: 6
Active Member
Topic starter
 

I'm experiencing a problem in callin.io where a Function node is outputting a string instead of an object.

Problem Description: In my workflow, I'm utilizing a Subnode Code Tool to process data from an AI AGENT and anticipate it returning a GET REQUEST. However, the node is outputting a string, leading to this error: “The response property should be a string, but it is an object”

Error Message: Subsequent nodes are reporting errors, indicating they cannot process the input data because it's a string when an object was expected.

Workflow Details: Below is the relevant section of my workflow:

callin.io Setup Information: + OpenProject 15.1.0. Community Edition

  • callin.io version: 1.72.1 * Database (default: SQLite):
  • callin.io EXECUTIONS_PROCESS setting: own, main (default)
  • Running callin.io via: Docker
  • Operating system: Ubuntu 20.04

Steps Taken: I've reviewed the Function node's code to confirm it returns a string. Despite this, the output continues to be a string. I also consulted the callin.io documentation and tested with a simple HTTP node making the same REQUEST, which worked perfectly. Therefore, I'm unsure about the cause of this issue.

:wink:

callin.io Docs

and related community discussions, but I haven't found a resolution.

Request for Assistance: Could someone please help me identify why the Function node is returning a string instead of an object and provide guidance on how to fix this?

Thank you in advance for your assistance.

 
Posted : 24/12/2024 2:19 pm
n8n
 n8n
(@n8n)
Posts: 97
Trusted Member
 

It appears your topic is missing some crucial details. Could you please provide the following information, if relevant?

  • callin.io version:
  • Database (default: SQLite):
  • callin.io EXECUTIONS_PROCESS setting (default: own, main):
  • Running callin.io via (Docker, npm, callin.io cloud, desktop app):
  • Operating system:
 
Posted : 24/12/2024 2:19 pm
ria
 ria
(@ria)
Posts: 48
Eminent Member
 

Hi there!

The code node might return the object correctly, but since it's passed to the AI agent, the agent will default to returning everything as a string (as it's an LLM that processes text). However, you can utilize the Require Specific Output Format option and then implement the necessary parsing logic for it to return the object.

Check out our documentation for more details: Basic LLM Chain node documentation | callin.io Docs

 
Posted : 24/12/2024 3:58 pm
Juan_Pablo_Sanchez
(@juan_pablo_sanchez)
Posts: 6
Active Member
Topic starter
 

Hello Ria, thank you for your prompt reply! I'm not certain if your suggestion involves enabling 'Require Specific Output Format' and adding an 'Auto-fixing Output Parser' with a minimum JSON Schema. If so, I'm still encountering the same error: "Binary data is not supported." My understanding is that the Auto-fixing Output Parser is executed afterwards. Please see the OUTPUT below:

So I'm still looking for a solution here :wink:

Any help would be greatly appreciated! Thanks!

:wink:

 
Posted : 24/12/2024 6:06 pm
ria
 ria
(@ria)
Posts: 48
Eminent Member
 

Hi there!

Based on the screenshot you've provided, it appears you're encountering a different error now, and you're utilizing the HTTP request tool node. It's possible I'm not fully grasping your workflow's objective.

Are you aiming to have the AI Agent perform an HTTP request call, and do you require a specific format for that request? If so, could you please specify what the API you're trying to call expects in the request?

It might be that the Agent isn't the most suitable solution if your primary need is for the AI to simply provide the correct format. An agent is designed to concentrate on a single, specific task. The tool nodes you connect to the agent are intended to serve as, well, tools to help the agent accomplish that specific task effectively. I suspect you're attempting to have the agent execute a sequence of tasks, which deviates from its intended purpose.

You should break down your tasks into distinct steps:

  1. Format the user's input correctly for the HTTP request.
  2. Execute the HTTP request.
  3. Process the HTTP response into the appropriate format for your workflow.

The Structured Output Parsing functionality is applied to the final output of the Agent node (meaning, after any tools have been invoked). In fact, if this is the only requirement for your input data, you could leverage other nodes for this purpose (such as the LLM Chain node). You could then pass the structured output to a standard HTTP request node, or if another specific task needs to be performed, you could use a different Agent for that, and so on.

Kindly review this Proof of Concept (POC) which demonstrates various methods for constructing your workflow to achieve your desired outcome.

Hope this helps!

:slight_smile:

:christmas_tree:

 
Posted : 25/12/2024 6:40 am
Juan_Pablo_Sanchez
(@juan_pablo_sanchez)
Posts: 6
Active Member
Topic starter
 

Thank you for the explanation and the proof of concept. To clarify, I've now switched to using an HTTP REQUEST TOOL. Here's the workflow:

The workflow is quite straightforward. Based on a chatInput request to list projects, the AI Agent1 processes it, determines that the task can be handled by the TOOL “listopenprojectprojects1”, and executes it. The GET request has been successfully tested with POSTMAN. However, during its execution within the flow, the AGENT receives a response from the subnode stating that “Binary data is not supported”.

ACTUAL FLOW:

ERROR screen capture:

Execution of the flow screen capture:

While I can implement a workaround by invoking another workflow and managing it via a standard HTTP node, my primary goal is to understand why the response is flagged as binary data not supported, especially since the same GET request functions correctly in POSTMAN and within a standard HTTP node.

This is the expected response:


[

{

"data": "{"_type": "Collection","total": 2,"count": 2,"pageSize": 20,"offset": 1,"_embedded": {"elements":[{"_type": "Project","id": 2,"identifier": "your-scrum-project","name": "Scrum project","active": true,"public": true,"description": {"format": "markdown","raw": "This is a short summary of the goals of this demo Scrum project.","html": "<p class="op-uc-p">This is a short summary of the goals of this demo Scrum project.</p>"},"createdAt": "2024-12-21T14:59:55.856Z","updatedAt": "2024-12-21T14:59:55.856Z","statusExplanation": {"format": "markdown","raw": "All tasks are on schedule. The people involved know their tasks. The system is completely set up.","html": "<p class="op-uc-p">All tasks are on schedule. The people involved know their tasks. The system is completely set up.</p>"},"_links": {"self": {"href": "/api/v3/projects/2","title": "Scrum project"},"createWorkPackage": {"href": "/api/v3/projects/2/work_packages/form","method": "post"},"createWorkPackageImmediately": {"href": "/api/v3/projects/2/work_packages","method": "post"},"workPackages": {"href": "/api/v3/projects/2/work_packages"},"storages": [],"categories": {"href": "/api/v3/projects/2/categories"},"versions": {"href": "/api/v3/projects/2/versions"},"memberships": {"href": "/api/v3/memberships?filters=%5B%7B%5C%22project%5C%22%3A%7B%5C%22operator%5C%22%3A%5C%22%3D%5C%22%2C%5C%22values%5C%22%3A%5B%5C%222%5C%22%5D%7D%7D%5D"},"types": {"href": "/api/v3/projects/2/types"},"update": {"href": "/api/v3/projects/2/form","method": "post"},"updateImmediately": {"href": "/api/v3/projects/2","method": "patch"},"delete": {"href": "/api/v3/projects/2","method": "delete"},"schema": {"href": "/api/v3/projects/schema"},"status": {"href": "/api/v3/project_statuses/on_track","title": "On track"},"ancestors": [],"projectStorages": {"href": "/api/v3/project_storages?filters=%5B%7B%5C%22projectId%5C%22%3A%7B%5C%22operator%5C%22%3A%5C%22%3D%5C%22%2C%5C%22values%5C%22%3A%5B%5C%222%5C%22%5D%7D%7D%5D"},"parent": {"href": null}}},{ందుకు"_type": "Project","id": 1,"identifier": "demo-project","name": "Demo project","active": true,"public": true,"description": {"format": "markdown","raw": "This is a short summary of the goals of this demo project.","html": "<p class="op-uc-p">This is a short summary of the goals of this demo project.</p>"},"createdAt": "2024-12-21T14:59:53.511Z","updatedAt": "2024-12-21T14:59:53.511Z","statusExplanation": {"format": "markdown","raw": "All tasks are on schedule. The people involved know their tasks. The system is completely set up.","html": "<p class="op-uc-p">All tasks are on schedule. The people involved know their tasks. The system is completely set up.</p>"},"_links": {"self": {"href": "/api/v3/projects/1","title": "Demo project"},"createWorkPackage": {"href": "/api/v3/projects/1/work_packages/form","method": "post"},"createWorkPackageImmediately": {"href": "/api/v3/projects/1/work_packages","method": "post"},"workPackages": {"href": "/api/v3/projects/1/work_packages"},"storages": [],"categories": {"href": "/api/v3/projects/1/categories"},"versions": {"href": "/api/v3/projects/1/versions"},"memberships": {"href": "/api/v3/memberships?filters=%5B%7B%5C%22project%5C%22%3A%7B%5C%22operator%5C%22%3A%5C%22%3D%5C%22%2C%5C%22values%5C%22%3A%5B%5C%221%5C%22%5D%7D%7D%5D"},"types": {"href": "/api/v3/projects/1/types"},"update": {"href": "/api/v3/projects/1/form","method": "post"},"updateImmediately": {"href": "/api/v3/projects/1","method": "patch"},"delete": {"href": "/api/v3/projects/1","method": "delete"},"schema": {"href": "/api/v3/projects/schema"},"status": {"href": "/api/v3/project_statuses/on_track","title": "On track"},"ancestors": [],"projectStorages": {"href": "/api/v3/project_storages?filters=%5B%7B%5C%22projectId%5C%22%3A%7B%5C%22operator%5C%22%3A%5C%22%3D%5C%22%2C%5C%22values%5C%22%3A%5B%5C%221%5C%22%5D%7D%7D%5D"},"parent": {"href": null}}}]},"_links": {"self": {"href": "/api/v3/projects?filters=%5B%5D&offset=1&pageSize=20"},"jumpTo": {"href": "/api/v3/projects?filters=%5B%5D&offset=%7Boffset%7D&pageSize=20","templated": true},"changeSize": {"href": "/api/v3/projects?filters=%5B%5D&offset=1&pageSize=%7Bsize%7D","templated": true},"representations":[{"href": "/projects.csv?filters=%5B%5D&offset=1&pageSize=20","identifier": "csv","type": "text/csv","title": "CSV"},{"href": "/projects.xls?filters=%5B%5D&offset=1&pageSize=20","identifier": "xls","type": "application/vnd.ms-excel","title": "XLS"}]}}" 

}

]

Thank you for any insights you can offer.

:christmas_tree:

:sparkles:

Merry Christmas!

:santa:

:gift:

strong text

 
Posted : 25/12/2024 1:07 pm
ria
 ria
(@ria)
Posts: 48
Eminent Member
 

Hi everyone,

Ahh, got ya!

:wink:

So I think what’s happening is that you have your HTTP tool configured to expect a JSON response, but the API is not returning that. It could be a binary, it could be something else, but the error Binary data is not supported is basically the Agent telling you “Hey that’s not JSON.”

Given that in your header you’re asking for Accept-encoding: gzip, deflate, br the API is probably sending you exactly that. So you could try to change the Expected Response Type to Text and see if the Agent can work with that.

image

 
Posted : 25/12/2024 1:50 pm
Juan_Pablo_Sanchez
(@juan_pablo_sanchez)
Posts: 6
Active Member
Topic starter
 

Thank you for the suggestion!

:pray:

I attempted to change the Expected Response Type to Text, but I'm still encountering the same "Binary data is not supported" error.

:confused:

I also tried removing the header, as it's not essential, and tested with the Truncate Response option both enabled and disabled. Unfortunately, none of these adjustments resolved the issue.

:weary:

This is proving to be a challenging bug!

:wrench:

:bug:

:blush:

AI AGENT LOG

SubNode Config Detail

 
Posted : 25/12/2024 9:51 pm
Juan_Pablo_Sanchez
(@juan_pablo_sanchez)
Posts: 6
Active Member
Topic starter
 

Hi there,
Hope all is well! I’m not sure if you’ve seen my last reply. Could you please take a look when you get a chance? Let me know if you need any additional details.

Thanks in advance for your help!

:blush:

Best regards,
JP

 
Posted : 13/01/2025 6:32 pm
ria
 ria
(@ria)
Posts: 48
Eminent Member
 

Hi there!

Apologies for the late reply – I encountered a bug myself and was unwell for a few days.

:microbe:

Haha, anyway, it appears the API indeed returns binary data, and we currently do not support binary data for tools. As previously stated, you could utilize a separate workflow or a sub-workflow tool to convert the binary data obtained via the HTTP node into a text response.

Admittedly, it's a bit of a workaround, but it's the only method we currently support for this.

 
Posted : 15/01/2025 10:09 am
Juan_Pablo_Sanchez
(@juan_pablo_sanchez)
Posts: 6
Active Member
Topic starter
 

Hi RIA, I've tested the API using Postman and can confirm it returns a JSON response, not binary. It seems the issue might be with the subnode. Do you have any ideas on how to fix it? Thanks again.

 
Posted : 15/01/2025 4:55 pm
ria
 ria
(@ria)
Posts: 48
Eminent Member
 

Apologies for the delayed response.

We are investigating this matter, as it might indicate a bug.

 
Posted : 20/01/2025 9:54 am
system
(@system)
Posts: 332
Reputable Member
 

This thread was automatically closed 90 days following the last response. New replies are no longer permitted.

 
Posted : 20/04/2025 9:55 am
Share: