n8n-io/n8n · error · UnexpectedError
Invalid file_ids type
Error message
Invalid file_ids type
What it means
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.
Source
Thrown at packages/@n8n/nodes-langchain/nodes/vendors/OpenAi/v1/actions/assistant/update.operation.ts:129
const displayOptions = {
show: {
operation: ['update'],
resource: ['assistant'],
},
};
export const description = updateDisplayOptions(displayOptions, properties);
function getFileIds(file_ids: unknown): string[] {
if (Array.isArray(file_ids)) {
return file_ids;
}
if (typeof file_ids === 'string') {
return file_ids.split(',').map((file_id) => file_id.trim());
}
throw new UnexpectedError('Invalid file_ids type');
}
export async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {
const assistantId = this.getNodeParameter('assistantId', i, '', { extractValue: true }) as string;
const options = this.getNodeParameter('options', i, {});
const {
modelId,
name,
instructions,
codeInterpreter,
knowledgeRetrieval,
file_ids,
removeCustomTools,
temperature,
topP,
} = options;
View on GitHub (pinned to 5ac6606e81)
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
Example fix
// before — file_ids: { id: 'file-abc' } (object)
// after — file_ids: 'file-abc' (string) Defensive patterns
Strategy: type-guard
Validate before calling
function validateFileIds(value: unknown): string[] {
if (Array.isArray(value)) return value as string[];
if (typeof value === 'string') return value.split(',').map(s => s.trim());
throw new UserError('file_ids must be an array or comma-separated string');
} Type guard
function isFileIdsInput(value: unknown): value is string | string[] {
return typeof value === 'string' || (Array.isArray(value) && value.every(v => typeof v === 'string'));
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- An assistant with the same name '${name}' already exists
- The maximum number of files that can be attached to the assi
- ${error.message}
- The maximum number of files that can be attached to the assi
- The file content is not in JSONL format
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/57884f845a66bdbd.
Report an issue: GitHub.