{"record":{"id":"e4b36c8f0080c822","repo":"n8n-io/n8n","slug":"invalid-response-from-python-script-expected-work","errorCode":null,"errorMessage":"Invalid response from Python script. Expected WorkflowSimilarityResult shape but got: ${stdout.slice(0, 200)}","messagePattern":"Invalid response from Python script\\. Expected WorkflowSimilarityResult shape but got: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/ai-workflow-builder.ee/evaluations/programmatic/evaluators/workflow-similarity.ts","lineNumber":170,"sourceCode":"\n\t\t\t// Only throw if we don't have valid output\n\t\t\tif (!stdout || stdout.trim() === '') {\n\t\t\t\tthrow execError;\n\t\t\t}\n\t\t}\n\n\t\t// Check if stdout is empty\n\t\tif (!stdout || stdout.trim() === '') {\n\t\t\tthrow new Error(\n\t\t\t\t`Python script produced no output. stderr: ${stderr || 'none'}. Command: uvx ${args.join(' ')}`,\n\t\t\t);\n\t\t}\n\n\t\t// Parse result\n\t\tconst parsed: unknown = JSON.parse(stdout);\n\n\t\tif (!isWorkflowSimilarityResult(parsed)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid response from Python script. Expected WorkflowSimilarityResult shape but got: ${stdout.slice(0, 200)}`,\n\t\t\t);\n\t\t}\n\n\t\t// Convert Python result to SingleEvaluatorResult format\n\t\tconst violations = parsed.top_edits.map((edit) => ({\n\t\t\tname: mapEditTypeToViolationName(edit.type),\n\t\t\ttype: edit.priority,\n\t\t\tdescription: edit.description,\n\t\t\tpointsDeducted: Math.round(edit.cost),\n\t\t}));\n\n\t\treturn {\n\t\t\tviolations,\n\t\t\tscore: parsed.similarity_score,\n\t\t};\n\t} catch (error) {\n\t\t// Handle specific error cases","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/ai-workflow-builder.ee/evaluations/programmatic/evaluators/workflow-similarity.ts#L152-L188","documentation":"Error \"Invalid response from Python script. Expected WorkflowSimilarityResult shape but got: ${stdout.slice(0, 200)}\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/ai-workflow-builder.ee/evaluations/programmatic/evaluators/workflow-similarity.ts:170 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}