langfuse/langfuse · error · LangfuseNotFoundError
Prompt not found
Error message
Prompt not found
What it means
LangfuseNotFoundError thrown by GET /api/public/prompts when no prompt with the given name (and optionally version or label) exists in the authorized project. Note this endpoint uses promptName, not the prompt's id.
Source
Thrown at web/src/pages/api/public/prompts.ts:71
const version = searchParams.version ?? undefined;
const rateLimitCheck =
await RateLimitService.getInstance().rateLimitRequest(
authCheck.scope,
"prompts",
);
if (rateLimitCheck?.isRateLimited()) {
return rateLimitCheck.sendRestResponseIfLimited(res);
}
const prompt = await getPromptByName({
promptName,
projectId,
version,
});
if (!prompt) throw new LangfuseNotFoundError("Prompt not found");
return res.status(200).json({
...prompt,
isActive: prompt.labels.includes(PRODUCTION_LABEL),
});
}
// Handle POST requests
if (req.method === "POST") {
const rateLimitCheck =
await RateLimitService.getInstance().rateLimitRequest(
authCheck.scope,
"prompts",
);
if (rateLimitCheck?.isRateLimited()) {
return rateLimitCheck.sendRestResponseIfLimited(res);
}View on GitHub (pinned to 59d92c7cf3)
Solutions
- Verify the exact prompt name (case-sensitive) in the Langfuse UI under Prompts
- Omit the version/label parameter to fetch the latest version and confirm the prompt exists at all
- Confirm the API key belongs to the same project as the prompt
Example fix
// before GET /api/public/prompts?version=5&promptName=sumary // after GET /api/public/prompts?version=5&promptName=summary
Defensive patterns
Strategy: try-catch
Try / catch
try { const p = await langfuse.getPrompt(name, version); } catch (e) { if (e?.status === 404) { return fallbackTemplate; } throw e; } Prevention
- Seed required prompts in CI before deploying code that fetches them
- Use the 'latest' label fetch during development to avoid version mismatch
- Keep prompt names as constants shared between creation code and fetch code
When it happens
Trigger: GET /api/public/prompts?promptName=my-prompt&version=3 with a typo'd name, a version that doesn't exist for that name, a prompt created in a different project, or a newly created prompt whose ClickHouse/Postgres read has not caught up yet.
Common situations: Prompt name casing/whitespace mismatch; deploying to an environment where the prompt was never created; requesting version 2 when only version 1 exists; querying immediately after creation.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Dataset item not found
- Observation not found
- Trace not found
- No model with this id found. Note: You cannot delete built-i
- NOT_FOUND
AI-assisted analysis of langfuse/langfuse@59d92c7cf3 (2026-08-27).
Data as JSON: /api/errors/562c22cb741120ae.
Report an issue: GitHub.