{"record":{"id":"57884f845a66bdbd","repo":"n8n-io/n8n","slug":"invalid-file-ids-type","errorCode":null,"errorMessage":"Invalid file_ids type","messagePattern":"Invalid file_ids type","errorType":"exception","errorClass":"UnexpectedError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vendors/OpenAi/v1/actions/assistant/update.operation.ts","lineNumber":129,"sourceCode":"const displayOptions = {\n\tshow: {\n\t\toperation: ['update'],\n\t\tresource: ['assistant'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nfunction getFileIds(file_ids: unknown): string[] {\n\tif (Array.isArray(file_ids)) {\n\t\treturn file_ids;\n\t}\n\n\tif (typeof file_ids === 'string') {\n\t\treturn file_ids.split(',').map((file_id) => file_id.trim());\n\t}\n\n\tthrow new UnexpectedError('Invalid file_ids type');\n}\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst assistantId = this.getNodeParameter('assistantId', i, '', { extractValue: true }) as string;\n\tconst options = this.getNodeParameter('options', i, {});\n\n\tconst {\n\t\tmodelId,\n\t\tname,\n\t\tinstructions,\n\t\tcodeInterpreter,\n\t\tknowledgeRetrieval,\n\t\tfile_ids,\n\t\tremoveCustomTools,\n\t\ttemperature,\n\t\ttopP,\n\t} = options;\n","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vendors/OpenAi/v1/actions/assistant/update.operation.ts#L111-L147","documentation":"The getFileIds helper in the Update Assistant operation parses the file_ids parameter into an array. It accepts either an array (passed directly) or a comma-separated string (split and trimmed). Any other type (number, object, boolean, null that is not caught earlier) throws an UnexpectedError — indicating a programming/config bug rather than a user input error, since the node parameter type should constrain input to string or fixedCollection array.","triggerScenarios":"The file_ids parameter in the Update Assistant options is populated with a value that is neither an array nor a string. This typically requires the node parameter value to be set programmatically or via API in a way that bypasses the UI type constraints.","commonSituations":"Workflow imported from JSON where file_ids was set to a number or object; programmatic workflow construction via the n8n API that doesn't match the expected parameter type; a node definition change that altered the parameter type without updating getFileIds.","solutions":["Set file_ids as a comma-separated string (e.g. 'file-abc,file-def') or as a fixedCollection array in the node UI","If importing the workflow from JSON, ensure file_ids is a string or array, not a number or object","If this appears during normal UI usage, report it as a node definition bug"],"exampleFix":"// before — file_ids: { id: 'file-abc' } (object)\n// after  — file_ids: 'file-abc' (string)","handlingStrategy":"type-guard","validationCode":"function validateFileIds(value: unknown): string[] {\n  if (Array.isArray(value)) return value as string[];\n  if (typeof value === 'string') return value.split(',').map(s => s.trim());\n  throw new UserError('file_ids must be an array or comma-separated string');\n}","typeGuard":"function isFileIdsInput(value: unknown): value is string | string[] {\n  return typeof value === 'string' || (Array.isArray(value) && value.every(v => typeof v === 'string'));\n}","tryCatchPattern":null,"preventionTips":["Always set file_ids through the node UI to ensure type constraints","When importing workflows from JSON, validate file_ids is string or string[]","Use comma-separated string format ('file-a,file-b') for simplicity"],"tags":["openai","assistant","file-ids","type-validation","unexpected","v1"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}