langfuse/langfuse · error · LangfuseNotFoundError

Project not found

Error message

Project not found

What it means

The projectId in the request body either does not exist or does not belong to the organization of the API key. The endpoint looks up the project and compares orgId to the token scope's orgId, throwing 404 to avoid leaking project existence.

Source

Thrown at web/src/pages/api/public/integrations/blob-storage/index.ts:155

      plan: authCheck.scope.plan,
      entitlement: "scheduled-blob-exports",
    })
  ) {
    throw new ForbiddenError(
      "scheduled-blob-exports entitlement required for this feature.",
    );
  }

  // Validate request body
  const validatedData = CreateBlobStorageIntegrationRequest.parse(req.body);

  // Check if the project exists and belongs to the organization
  const project = await prisma.project.findUnique({
    where: { id: validatedData.projectId },
    select: { id: true, orgId: true, createdAt: true },
  });
  if (!project || project.orgId !== authCheck.scope.orgId) {
    throw new LangfuseNotFoundError("Project not found");
  }

  const internalExportSource =
    validatedData.exportSource != null
      ? toInternalExportSource(validatedData.exportSource)
      : undefined;

  // Feeds both write-time gates: the legacy upsert gate needs the row's
  // createdAt when exportSource is provided; the enriched gate needs the
  // persisted exportSource when it is omitted (partial PUT), so a stale
  // enriched value is rejected.
  const existingIntegration = await prisma.blobStorageIntegration.findUnique({
    where: { projectId: validatedData.projectId },
    select: { createdAt: true, exportSource: true },
  });

  // Explicit sources must pass every check; an omitted source keeps the
  // persisted one, capability-checked only, and a create falls back to the

View on GitHub (pinned to 59d92c7cf3)

Solutions

  1. List the org's projects (GET /api/public/projects) and use the exact projectId from the same org as the API key
  2. Confirm the project still exists in the UI

Example fix

// before
body: JSON.stringify({ projectId: 'proj-from-staging', ... })

// after
const projects = await listProjects(orgAuth);
body: JSON.stringify({ projectId: projects.find(p => p.name === 'prod').id, ... })
Defensive patterns

Strategy: validation

Validate before calling

const projects = await langfusePublicApi.projects.list();
const project = projects.data.find(p => p.id === bodyProjectId);
if (!project) throw new Error('projectId not in this org');

Try / catch

catch (e) { if (e.status === 404) retryAfterProjectSync(); throw e; }

Prevention

When it happens

Trigger: PUT /api/public/integrations/blob-storage with a projectId from another organization, a deleted project, or a typo'd id.

Common situations: Hardcoded project ids copied between environments (staging id used against production), or after a project was deleted.

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


AI-assisted analysis of langfuse/langfuse@59d92c7cf3 (2026-08-27). Data as JSON: /api/errors/6e6ced2969708a2a. Report an issue: GitHub.