{"record":{"id":"d62cbafec93271ca","repo":"n8n-io/n8n","slug":"seed-endpoint-endpoint-is-the-secondary-us","errorCode":null,"errorMessage":"seed.endpoint \"${endpoint}\" is the secondary (US) tenant but LANGSMITH_API_KEY_US is not set — refusing to read it with the home key. Set LANGSMITH_API_KEY_US.","messagePattern":"seed\\.endpoint \"(.+?)\" is the secondary \\(US\\) tenant but LANGSMITH_API_KEY_US is not set — refusing to read it with the home key\\. Set LANGSMITH_API_KEY_US\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/harness/langsmith-seed.ts","lineNumber":102,"sourceCode":" * LANGSMITH_API_KEY_US. A non-home host with no configured key THROWS rather\n * than silently read with the home key — which would query the wrong tenant and\n * report the thread as missing. Writes never go through here; they stay home.\n */\nexport function configFor(endpoint?: string): { apiUrl: string; apiKey: string } {\n\tconst homeHost = bareHost(\n\t\tprocess.env.LANGSMITH_ENDPOINT ?? process.env.LANGCHAIN_ENDPOINT ?? US_DEFAULT_ENDPOINT,\n\t);\n\tconst homeKey = process.env.LANGSMITH_API_KEY ?? process.env.LANGCHAIN_API_KEY ?? '';\n\tif (!endpoint) return { apiUrl: homeHost, apiKey: homeKey };\n\n\tconst host = bareHost(endpoint);\n\tif (host === homeHost) return { apiUrl: host, apiKey: homeKey };\n\n\tconst usHost = bareHost(process.env.LANGSMITH_ENDPOINT_US ?? US_DEFAULT_ENDPOINT);\n\tif (host === usHost) {\n\t\tconst usKey = process.env.LANGSMITH_API_KEY_US ?? '';\n\t\tif (!usKey) {\n\t\t\tthrow new Error(\n\t\t\t\t`seed.endpoint \"${endpoint}\" is the secondary (US) tenant but LANGSMITH_API_KEY_US is not set — refusing to read it with the home key. Set LANGSMITH_API_KEY_US.`,\n\t\t\t);\n\t\t}\n\t\treturn { apiUrl: usHost, apiKey: usKey };\n\t}\n\tthrow new Error(\n\t\t`seed.endpoint \"${endpoint}\" matches no configured LangSmith tenant (home: ${homeHost}; secondary: ${usHost}). Set LANGSMITH_ENDPOINT_US + LANGSMITH_API_KEY_US, or omit endpoint to use the home tenant.`,\n\t);\n}\n\n/** Workspaces a key can access on a host. Returns [] on any failure so the\n *  caller falls back to the key's default workspace. */\nasync function listAccessibleWorkspaces(\n\tapiUrl: string,\n\tapiKey: string,\n): Promise<Array<{ id: string; name: string }>> {\n\tif (!apiKey) return [];\n\ttry {","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/harness/langsmith-seed.ts#L84-L120","documentation":"Thrown by configFor() in langsmith-seed.ts when a seed's endpoint host matches the configured US (secondary) tenant but the LANGSMITH_API_KEY_US environment variable is unset/empty. The harness refuses to fall back to the home key to read a US tenant, because cross-tenant reads with the wrong key either fail opaquely or read the wrong data. The error names the missing variable explicitly.","triggerScenarios":"A seed.threadId whose `endpoint` resolves to the US LangSmith host, run in an environment where LANGSMITH_API_KEY_US is not exported. Also if LANGSMITH_ENDPOINT_US was overridden to a host and no US key was paired with it.","commonSituations":"Developer set LANGSMITH_ENDPOINT/LANGCHAIN_ENDPOINT to the US region but only provisioned the home key; CI secret for the US key missing; the seed was authored against the US tenant but run locally without the US credentials.","solutions":["Export LANGSMITH_API_KEY_US with a key valid for the US tenant.","If you did not intend the US tenant, change seed.endpoint (or LANGSMITH_ENDPOINT) to the home host, or omit it to use the home default.","Ensure CI secrets include LANGSMITH_API_KEY_US whenever US-hosted traces are read."],"exampleFix":"// before\n$ export LANGSMITH_ENDPOINT=https://us.api.langsmith.com\n$ export LANGSMITH_API_KEY=lsv2_home...\n$ tsx run-eval  # seed.endpoint is US, no US key\n// after\n$ export LANGSMITH_ENDPOINT=https://us.api.langsmith.com\n$ export LANGSMITH_API_KEY_US=lsv2_us...\n$ tsx run-eval","handlingStrategy":"validation","validationCode":"// Pre-flight env check before reading a US-hosted seed.\nfunction assertTenantKeys(endpoint: string | undefined, homeHost: string, usHost: string): void {\n  if (!endpoint) return;\n  const host = bareHost(endpoint);\n  if (host === usHost && !process.env.LANGSMITH_API_KEY_US) {\n    throw new Error('LANGSMITH_API_KEY_US must be set to read US-hosted LangSmith traces.');\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair LANGSMITH_ENDPOINT_US with LANGSMITH_API_KEY_US whenever US traces are used.","Keep CI secrets symmetric across home and US tenants.","Default to the home tenant (omit endpoint) unless a trace genuinely lives in the US tenant."],"tags":["langsmith","env","credentials","multi-tenant"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}