n8n-io/n8n · error · Error
No prompt found in inputs - expected "prompt" string or "mes
Error message
No prompt found in inputs - expected "prompt" string or "messages" array
What it means
`extractPrompt` reads a single prompt from a LangSmith dataset example's `inputs`. It accepts either a `prompt` string or a non-empty `messages` array (in which case it takes `messages[0]`). If neither shape is present, the example is unusable and the harness aborts. This protects downstream agents from being invoked with an undefined prompt.
Source
Thrown at packages/@n8n/ai-workflow-builder.ee/evaluations/harness/runner.ts:1002
[key: string]: unknown;
}
/**
* Extract prompt from dataset input.
* Supports both direct prompt and messages array format.
*/
function extractPrompt(inputs: LangsmithDatasetInput): string {
// Direct prompt string
if (inputs.prompt && typeof inputs.prompt === 'string') {
return inputs.prompt;
}
// Messages array format
if (inputs.messages && Array.isArray(inputs.messages) && inputs.messages.length > 0) {
return extractMessageContent(inputs.messages[0]);
}
throw new Error('No prompt found in inputs - expected "prompt" string or "messages" array');
}
/**
* Pre-process LangSmith examples to extract conversation history from outputs
* and inject it into inputs for the target function.
*
* The dataset format has:
* - inputs.messages[0]: The latest user turn
* - outputs.messages: The FULL conversation (all prior turns + latest + AI response)
*
* We find the latest turn in outputs and extract everything before it as historical.
*/
function enrichExamplesWithHistory(examples: Example[]): Example[] {
return examples.map((example) => {
const outputMessages = (example.outputs as Record<string, unknown> | undefined)?.messages;
if (!Array.isArray(outputMessages) || outputMessages.length <= 1) {
return example; // No history to extract
}View on GitHub (pinned to 5ac6606e81)
Solutions
- Open the dataset in the LangSmith UI and confirm each example's `inputs` has either a `prompt` string or a non-empty `messages` array.
- If your schema uses a different field, either rename it to `prompt` in the dataset or extend `extractPrompt` to read your field.
- Filter out malformed examples before running, or fix them in place.
Example fix
// before
// example.inputs = { workflowJSON: {...} } (no prompt/messages)
// after
// example.inputs = { prompt: "build a slack notifier", workflowJSON: {...} } Defensive patterns
Strategy: type-guard
Validate before calling
function hasUsablePrompt(inputs: unknown): boolean {
if (!inputs || typeof inputs !== 'object') return false;
const r = inputs as Record<string, unknown>;
if (typeof r.prompt === 'string' && r.prompt.length > 0) return true;
return Array.isArray(r.messages) && r.messages.length > 0;
}
// filter the dataset up front
const usable = examples.filter((e) => hasUsablePrompt(e.inputs));
if (usable.length === 0) throw new Error('no dataset examples have a prompt or messages array'); Type guard
function isPromptableInput(inputs: unknown): inputs is { prompt: string } | { messages: unknown[] } {
if (!inputs || typeof inputs !== 'object') return false;
const r = inputs as Record<string, unknown>;
if (typeof r.prompt === 'string' && r.prompt.length > 0) return true;
return Array.isArray(r.messages) && r.messages.length > 0;
} Prevention
- Validate dataset examples in a pre-run lint pass and report which example ids are missing prompts.
- Document the accepted input schema (`prompt` string OR `messages` array) next to the dataset upload tool.
- Add a contract test that feeds a fixture example without a prompt and asserts the error.
When it happens
Trigger: A dataset example whose `inputs` has neither a `prompt` field nor a `messages` array — e.g. it only carries `workflowJSON`, custom metadata, or a `messages` array that is empty. Also triggered by malformed examples uploaded with the wrong field names.
Common situations: Dataset schema drift (field renamed from `prompt` to `user_prompt`); examples created by a different tool that uses `input`/`query`; an example whose `messages` array was stripped during export; copy-pasting an example and dropping the prompt field.
Related errors
- LangSmith mode requires dataset to be a dataset name string
- No message provided
- Message content must be a string or contain text content
- Tool "${this.name}" requires an input schema
- LangSmith mode requires `--dataset` and does not support `--
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/eadbfc98ec1cceb8.
Report an issue: GitHub.