{"record":{"id":"8fb2c58354cd3e44","repo":"n8n-io/n8n","slug":"trace-project-projectname-not-found-in-the-ev","errorCode":null,"errorMessage":"Trace project \"${projectName}\" not found in the eval workspace — is this the right tenant/workspace?","messagePattern":"Trace project \"(.+?)\" not found in the eval workspace — is this the right tenant/workspace\\?","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/cli/build-cost-report.ts","lineNumber":134,"sourceCode":"\t\t\t...(workspaceId ? { 'X-Tenant-Id': workspaceId } : {}),\n\t\t},\n\t};\n}\n\nasync function resolveTraceProjectId(ls: LangSmithConfig, projectName: string): Promise<string> {\n\tconst res = await lsFetch(\n\t\t`${ls.apiUrl}/api/v1/sessions?name=${encodeURIComponent(projectName)}`,\n\t\t{\n\t\t\theaders: ls.headers,\n\t\t},\n\t);\n\tif (!res.ok) {\n\t\tthrow new Error(`LangSmith sessions lookup failed: ${res.status} ${await res.text()}`);\n\t}\n\tconst projects = z.array(lsProjectSchema).parse(await res.json());\n\tconst match = projects.find((p) => p.name === projectName);\n\tif (!match) {\n\t\tthrow new Error(\n\t\t\t`Trace project \"${projectName}\" not found in the eval workspace — is this the right tenant/workspace?`,\n\t\t);\n\t}\n\treturn match.id;\n}\n\ninterface ThreadCost {\n\tcostUsd: number;\n\ttokens: number;\n\t/** Root runs in the thread — one per build turn. */\n\tturns: number;\n}\n\nconst RUNS_QUERY_LIMIT = 100;\n\n/** Sum a thread's root runs (one per turn); roots aggregate their children,\n *  so this is the thread's whole backend LLM spend. Null when the thread has\n *  no runs in the project — an unknown cost, not a $0 build (wrong","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/cli/build-cost-report.ts#L116-L152","documentation":"Thrown by resolveTraceProjectId() (build-cost-report.ts:134) when the sessions lookup succeeds (HTTP OK) but no project in the returned list matches the requested projectName exactly. This means the trace project does not exist in the resolved eval workspace/tenant. The message hints at a wrong tenant or workspace, since the project name is fixed per run and the workspace is resolved separately.","triggerScenarios":"The trace project name (default 'instance-ai-evals', overridable via --trace-project) does not exist in the eval workspace that resolveEvalWorkspaceId() resolved. This happens when evals ran under a different project name, or the X-Tenant-Id header resolved to a workspace that does not contain that project.","commonSituations":"The eval harness wrote traces to a project named differently from the default (e.g. a custom --trace-project was used during the eval but not the report), the eval workspace ID resolved wrong (env misconfiguration), or the evals simply have not produced traces in that project yet.","solutions":["Pass the correct project name via --trace-project <name> matching what the eval harness used.","Verify the eval workspace is correct — check the workspace ID resolution (resolveEvalWorkspaceId) and the LANGSMITH_* env vars.","Confirm traces have landed: query the LangSmith UI for the expected project name in the right tenant.","If running a custom cohort, ensure the eval run and the cost report agree on the project name."],"exampleFix":"// before\npnpm tsx evaluations/cli/build-cost-report.ts --results aia-run/eval-results.json\n// after (traces landed under a different project name)\npnpm tsx evaluations/cli/build-cost-report.ts --results aia-run/eval-results.json --trace-project instance-ai-evals-staging","handlingStrategy":"validation","validationCode":"// Before resolving, confirm the project exists in the workspace:\nasync function projectExists(ls: LangSmithConfig, name: string): Promise<boolean> {\n  const res = await fetch(`${ls.apiUrl}/api/v1/sessions?name=${encodeURIComponent(name)}`, { headers: ls.headers });\n  const projects = await res.json();\n  return Array.isArray(projects) && projects.some((p: { name: string }) => p.name === name);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const id = await resolveTraceProjectId(ls, traceProject);\n} catch (error) {\n  const msg = error instanceof Error ? error.message : String(error);\n  if (msg.includes('not found in the eval workspace')) {\n    console.error(`Trace project \"${traceProject}\" missing — pass --trace-project <name> matching the eval run.`);\n    process.exit(2);\n  }\n  throw error;\n}","preventionTips":["Pin --trace-project to the exact name the eval harness used.","Verify the resolved eval workspace (tenant) matches where traces landed.","Check the LangSmith UI for the project before running the report."],"tags":["langsmith","configuration","instance-ai","cost-report"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}