langfuse/langfuse · error · Error
Dataset item has no input.
Error message
Dataset item has no input.
What it means
replaceVariablesInPrompt in the experiments worker requires the dataset item to have an input object; when itemInput is null it throws 'Dataset item has no input.' before building the chat messages.
Source
Thrown at worker/src/features/experiments/utils.ts:80
const fetchPrompt = async (promptId: string, projectId: string) => {
const promptService = new PromptService(prisma, redis);
const rawPrompt = await prisma.prompt.findUnique({
where: { id: promptId, projectId },
});
return promptService.resolvePrompt(rawPrompt);
};
export const replaceVariablesInPrompt = (
prompt: PromptContent,
itemInput: Record<string, any> | null,
variables: string[],
placeholderNames: string[] = [],
): ChatMessage[] => {
if (!itemInput) {
throw Error("Dataset item has no input.");
}
const processContent = (content: string) => {
// Extract only template variables from itemInput (exclude message placeholders)
const filteredContext = Object.fromEntries(
Object.entries(itemInput).filter(
([key]) => variables.includes(key) && !placeholderNames.includes(key),
),
);
// Apply template ONLY if the content contains `{{variable}}` pattern
if (content.includes("{{")) {
return compileTemplateString(content, filteredContext);
}
return content; // Return original content if no placeholders are found
};
if (typeof prompt === "string") {
return [View on GitHub (pinned to 59d92c7cf3)
Solutions
- Clean the dataset: remove or fix items with null input before running the experiment.
- Ensure ingested dataset items actually capture the input payload you map variables from.
- Adjust the prompt to only use variables present in every item.
Defensive patterns
Strategy: validation
Validate before calling
const usable = items.filter(i => i.input != null && typeof i.input === "object"); if (usable.length < items.length) warnAndSkipNullInputItems();
Type guard
const hasInput = (item: DatasetItem): item is DatasetItem & { input: Record<string, any> } => item.input != null && typeof item.input === "object"; Try / catch
catch (e) { if (e.message === "Dataset item has no input.") reportSkippedItemAndContinue(); } Prevention
- Filter null-input dataset items before creating experiments
- Ensure ingestion captures input payloads on dataset items
- Keep prompt variables limited to fields present on every item
When it happens
Trigger: Running an experiment whose dataset contains an item with no input (null/empty), while the prompt template declares variables that must be filled from item input.
Common situations: Datasets with mixed items (some input-less), items created from spans without input payloads, or prompts relying on variables the dataset doesn't consistently provide.
Related errors
- Missing placeholder value for '${placeholderName}'
- Invalid placeholder value for '${placeholderName}': unable t
- Placeholder '${placeholderName}' must be an array of message
- Invalid placeholder value for '${placeholderName}': all item
- Dataset item ${datasetItemId} for project ${projectId} not f
AI-assisted analysis of langfuse/langfuse@59d92c7cf3 (2026-08-27).
Data as JSON: /api/errors/7b1f6117a51ea8e2.
Report an issue: GitHub.