{"record":{"id":"9760016d42562554","repo":"langfuse/langfuse","slug":"authcheck-error-976001","errorCode":null,"errorMessage":"${authCheck.error}","messagePattern":"\\$\\{authCheck\\.error\\}","errorType":"http","errorClass":null,"httpStatus":401,"severity":"error","filePath":"web/src/pages/api/public/organizations/projects/index.ts","lineNumber":32,"sourceCode":") {\n  await runMiddleware(req, res, cors);\n\n  if (req.method !== \"GET\") {\n    logger.error(\n      `Method not allowed for ${req.method} on /api/public/organizations/projects`,\n    );\n    return res.status(405).json({\n      error: \"Method not allowed\",\n    });\n  }\n\n  // CHECK AUTH\n  const authCheck = await new ApiAuthService(\n    prisma,\n    redis,\n  ).verifyAuthHeaderAndReturnScope(req.headers.authorization);\n  if (!authCheck.validKey) {\n    return res.status(401).json({\n      error: authCheck.error,\n    });\n  }\n  // END CHECK AUTH\n\n  // Check if using an organization API key\n  if (\n    authCheck.scope.accessLevel !== \"organization\" ||\n    !authCheck.scope.orgId\n  ) {\n    return res.status(403).json({\n      error:\n        \"Invalid API key. Organization-scoped API key required for this operation.\",\n    });\n  }\n\n  if (\n    !hasEntitlementBasedOnPlan({","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/langfuse/langfuse/blob/59d92c7cf365150d10b753b5a0d1708902a2ed60/web/src/pages/api/public/organizations/projects/index.ts#L14-L50","documentation":"HTTP 401 auth failure on the org projects endpoint: the Authorization header failed verification; the response body interpolates authCheck.error, which explains the specific reason (missing header, invalid key, etc.).","triggerScenarios":"Calling GET /api/public/organizations/projects without a valid Basic auth header or with an invalid/revoked key.","commonSituations":"Missing Authorization header, wrong key, wrong host.","solutions":["Read the interpolated error message for the exact cause","Send 'Authorization: Basic base64(pk:sk)' with an org key","Verify key validity in organization settings"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const auth = 'Basic ' + Buffer.from(`${pk}:${sk}`).toString('base64');\nif (!pk || !sk) throw new Error('Missing credentials');","typeGuard":null,"tryCatchPattern":"try { ... } catch (e) { if (e.status === 401) reportAuthError(e.body.error); }","preventionTips":["Surface the interpolated authCheck.error message for diagnosis"],"tags":["authentication","http-401","api-key","admin-api"],"backgroundTag":"invalid-api-key","analyzedSha":"59d92c7cf365150d10b753b5a0d1708902a2ed60","analyzedAt":"2026-08-27T22:22:00.402Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}