n8n-io/n8n · warning · UserError
Additional Model Request Fields must be a JSON object
Error message
Additional Model Request Fields must be a JSON object
What it means
Companion to error 682: thrown after jsonParse succeeds but isJsonObject(parsed) is false. The Bedrock InvokeModel API requires additionalModelRequestFields to be a JSON object (key/value pairs); a JSON array, number, string, or boolean is syntactically valid JSON but semantically wrong, so the UserError pinpoints the shape problem.
Source
Thrown at packages/@n8n/nodes-langchain/nodes/embeddings/EmbeddingsAwsBedrock/EmbeddingsAwsBedrock.node.ts:161
credentials,
bedrockRuntimeEndpoint,
maxRetries: options.maxRetries,
timeout: options.timeout,
});
let additionalModelRequestFields: Record<string, unknown> | undefined;
const additionalFields = options.additionalModelRequestFields?.trim();
if (additionalFields && additionalFields !== '{}') {
let parsed: unknown;
try {
parsed = jsonParse(additionalFields);
} catch {
throw new UserError('Additional Model Request Fields must be valid JSON', {
level: 'warning',
});
}
if (!isJsonObject(parsed)) {
throw new UserError('Additional Model Request Fields must be a JSON object', {
level: 'warning',
});
}
additionalModelRequestFields = parsed;
}
const embeddings = new BedrockInvokeModelEmbeddings({
client,
model: modelName,
additionalModelRequestFields,
});
return {
response: logWrapper(embeddings, this),
};
}
}
View on GitHub (pinned to 5ac6606e81)
Solutions
- Wrap the value in an object: pass {"key": "value"} rather than a bare array or primitive.
- If you only intended one override, find the correct parameter name in the Bedrock model docs and use it as a key.
- Leave the field empty (or {}) when no additional fields are required.
Example fix
// before
options.additionalModelRequestFields = "[512, 1024]"
// after
options.additionalModelRequestFields = "{\"dimensions\": 512}" Defensive patterns
Strategy: type-guard
Validate before calling
const parsed = JSON.parse(raw);
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
throw new Error('Additional Model Request Fields must be a JSON object');
} Type guard
const isJsonObject = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null && !Array.isArray(v);
Try / catch
// Validate shape after parsing; reject non-objects before they reach the node.
Prevention
- Always wrap overrides in an object literal: {"key": value}.
- Document with examples in the node's option description.
- Add a CI check that scans for additionalModelRequestFields values that are arrays/primitives.
When it happens
Trigger: User enters [1,2,3], 256, true, or "hello" in 'Additional Model Request Fields' — parses cleanly as JSON but is not an object. Also triggered by a templated expression returning a JSON array literal.
Common situations: Confusing the field with a list-style option; pasting an array of model IDs instead of request overrides; templating that emits a primitive.
Related errors
- Additional Model Request Fields must be valid JSON
- The value in the "Extra Body" field must be a JSON object
- Additional Model Request Fields must be valid JSON
- Telemetry tracer must implement startSpan() and startActiveS
- Failed to read prebuilt-workflows manifest at ${path}: ${msg
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/0a8c4ea2d1c3fa70.
Report an issue: GitHub.