{"record":{"id":"e2d601d568596e16","repo":"n8n-io/n8n","slug":"langsmith-workspace-name-not-found-among-w","errorCode":null,"errorMessage":"LangSmith workspace \"${name}\" not found among [${workspaces.map((w) => w.name).join(', ')}]. Check LANGSMITH_API_KEY (org PAT) + LANGSMITH_ENDPOINT (region).","messagePattern":"LangSmith workspace \"(.+?)\" not found among \\[(.+?)\\]\\. Check LANGSMITH_API_KEY \\(org PAT\\) \\+ LANGSMITH_ENDPOINT \\(region\\)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/harness/langsmith-seed.ts","lineNumber":149,"sourceCode":"\t\t});\n\t} catch {\n\t\treturn [];\n\t}\n}\n\n/** Workspace eval writes are pinned to; resolved to an id by name so no UUID lives in the repo. */\nexport const EVAL_WORKSPACE_NAME = 'Staging';\n\n/** Eval workspace id by name; undefined for a workspace-scoped key (already locked to one), throws when a PAT lacks it. */\nexport async function resolveEvalWorkspaceId(\n\tname: string = EVAL_WORKSPACE_NAME,\n): Promise<string | undefined> {\n\tconst { apiUrl, apiKey } = configFor();\n\tconst workspaces = await listAccessibleWorkspaces(apiUrl, apiKey);\n\tconst match = workspaces.find((w) => w.name === name);\n\tif (match) return match.id;\n\tif (workspaces.length <= 1) return undefined; // scoped/single-workspace key: nothing to choose\n\tthrow new Error(\n\t\t`LangSmith workspace \"${name}\" not found among [${workspaces.map((w) => w.name).join(', ')}]. Check LANGSMITH_API_KEY (org PAT) + LANGSMITH_ENDPOINT (region).`,\n\t);\n}\n\n/** Seams for unit-testing workspace discovery without the network. */\nexport interface SeedDiscoveryDeps {\n\tlistWorkspaces: () => Promise<Array<{ id: string; name: string }>>;\n\tclientForWorkspace: (workspaceId: string) => Client;\n\tambientClient: () => Client;\n}\n\n/** Build discovery deps bound to one tenant (host + key resolved from the seed\n *  ref's endpoint). All three seams target that host, so cross-workspace\n *  discovery stays within the chosen tenant. */\nfunction discoveryDepsFor(endpoint?: string): SeedDiscoveryDeps {\n\tconst { apiUrl, apiKey } = configFor(endpoint);\n\treturn {\n\t\tlistWorkspaces: async () => await listAccessibleWorkspaces(apiUrl, apiKey),","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/harness/langsmith-seed.ts#L131-L167","documentation":"Thrown by resolveEvalWorkspaceId() when the configured key can list more than one workspace but none of them is named 'Staging' (EVAL_WORKSPACE_NAME). Workspaces are discovered via the LangSmith workspaces API; if exactly one workspace is accessible (or none), the function returns undefined (scoped key), but a PAT that sees multiple workspaces must explicitly contain 'Staging'. The error lists the visible names so the developer can see what the key can reach.","triggerScenarios":"Running evals with an org PAT whose workspaces do not include 'Staging'; the workspace was renamed; the LANGSMITH_API_KEY points at a different org/region than expected; the key is scoped to a single non-Staging workspace but the API returned >1 (org PAT).","commonSituations":"Org PAT missing the Staging workspace; region mismatch (US key against home endpoint); workspace renamed since the eval was configured.","solutions":["Provision LANGSMITH_API_KEY as an org PAT whose workspaces include 'Staging'.","Confirm LANGSMITH_ENDPOINT region matches the key (a US key against the home endpoint shows the wrong workspaces).","If the workspace was renamed, update EVAL_WORKSPACE_NAME or create a 'Staging' workspace."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-flight: confirm the Staging workspace is reachable before writing.\nconst workspaces = await listAccessibleWorkspaces(apiUrl, apiKey);\nif (workspaces.length > 1 && !workspaces.some((w) => w.name === EVAL_WORKSPACE_NAME)) {\n  throw new Error(`LANGSMITH_API_KEY can see [${workspaces.map((w) => w.name).join(', ')}] but not \"${EVAL_WORKSPACE_NAME}\". Use an org PAT for the correct org/region.`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use an org PAT (not a workspace-scoped key) whose workspaces include 'Staging'.","Keep LANGSMITH_ENDPOINT region consistent with the key.","If 'Staging' is renamed, update EVAL_WORKSPACE_NAME in the same change."],"tags":["langsmith","workspace","permissions","env"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}