{"record":{"id":"562c22cb741120ae","repo":"langfuse/langfuse","slug":"prompt-not-found-562c22","errorCode":null,"errorMessage":"Prompt not found","messagePattern":"Prompt not found","errorType":"exception","errorClass":"LangfuseNotFoundError","httpStatus":404,"severity":"error","filePath":"web/src/pages/api/public/prompts.ts","lineNumber":71,"sourceCode":"      const version = searchParams.version ?? undefined;\n\n      const rateLimitCheck =\n        await RateLimitService.getInstance().rateLimitRequest(\n          authCheck.scope,\n          \"prompts\",\n        );\n\n      if (rateLimitCheck?.isRateLimited()) {\n        return rateLimitCheck.sendRestResponseIfLimited(res);\n      }\n\n      const prompt = await getPromptByName({\n        promptName,\n        projectId,\n        version,\n      });\n\n      if (!prompt) throw new LangfuseNotFoundError(\"Prompt not found\");\n\n      return res.status(200).json({\n        ...prompt,\n        isActive: prompt.labels.includes(PRODUCTION_LABEL),\n      });\n    }\n\n    // Handle POST requests\n    if (req.method === \"POST\") {\n      const rateLimitCheck =\n        await RateLimitService.getInstance().rateLimitRequest(\n          authCheck.scope,\n          \"prompts\",\n        );\n\n      if (rateLimitCheck?.isRateLimited()) {\n        return rateLimitCheck.sendRestResponseIfLimited(res);\n      }","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/langfuse/langfuse/blob/59d92c7cf365150d10b753b5a0d1708902a2ed60/web/src/pages/api/public/prompts.ts#L53-L89","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nGET /api/public/prompts?version=5&promptName=sumary\n// after\nGET /api/public/prompts?version=5&promptName=summary","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { const p = await langfuse.getPrompt(name, version); } catch (e) { if (e?.status === 404) { return fallbackTemplate; } throw e; }","preventionTips":["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"],"tags":["not-found","prompts","public-api"],"backgroundTag":"resource-not-found","analyzedSha":"59d92c7cf365150d10b753b5a0d1708902a2ed60","analyzedAt":"2026-08-27T22:22:00.402Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}