Common Error Scenarios

Learn how to identify and fix common issues that occur when accessing data between workflow steps.

File Content Access

// Problem: Contents are empty
const contents = util.getFileContents(input.document);
// Problem: Images are empty
const images = util.getFileImages(input.document);

Solution: Enable Extract Contents and Extract Images in the file field settings, then delete the existing uploaded file(s) and re-upload them for the extraction process to take place.

Model Step JSON Parsing

// Problem: Trying to parse already parsed JSON
const data = util.parse(MODEL_STEP.output.message); // Error!

// Solution: With Response set to JSON
const data = MODEL_STEP.output.message; // Already parsed

// Solution: Without Response set to JSON
const data = util.parse(MODEL_STEP.output.message);

Operations in Placeholders

Operations can only be performed in Code step placeholders where we have direct access to objects like input.* and MODEL_STEP.*. For other step types that use double curly brace placeholders ({{...}}), operations are not supported and you’ll need to use a Code step instead.

Don’t do this:

{{input.categories.split(',').join('\n')}}
{{MODEL_ANALYZE.output.message.slice(0, 1000)}}

Solution: Create a Code step to perform operations and return the processed data:

return {
  categories: input.categories.split(',').join('\n'),
  truncatedMessage: MODEL_ANALYZE.output.message.slice(0, 1000),
};

Then reference the processed data:

{{CODE_PROCESS.output.categories}}
{{CODE_PROCESS.output.truncatedMessage}}

This approach also keeps data processing logic in Code steps where it belongs and makes the workflow more maintainable.

Debugging Techniques

Debugging techniques to identify and fix issues in your workflow steps.

Using console.log()

In Code steps, you can use console.log() to inspect values:

const stepOutput = MODEL_STEP.output;
console.log('Step output:', stepOutput);

Return Values

You can also return values to see them in the step output:

const inputData = input.document;
return inputData;

The returned value will be displayed in the step output panel when you run the workflow.