n8n-io/n8n · error · Error

seed.endpoint "${endpoint}" is the secondary (US) tenant but

Error message

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.

What it means

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.

Source

Thrown at packages/@n8n/instance-ai/evaluations/harness/langsmith-seed.ts:102

 * LANGSMITH_API_KEY_US. A non-home host with no configured key THROWS rather
 * than silently read with the home key — which would query the wrong tenant and
 * report the thread as missing. Writes never go through here; they stay home.
 */
export function configFor(endpoint?: string): { apiUrl: string; apiKey: string } {
	const homeHost = bareHost(
		process.env.LANGSMITH_ENDPOINT ?? process.env.LANGCHAIN_ENDPOINT ?? US_DEFAULT_ENDPOINT,
	);
	const homeKey = process.env.LANGSMITH_API_KEY ?? process.env.LANGCHAIN_API_KEY ?? '';
	if (!endpoint) return { apiUrl: homeHost, apiKey: homeKey };

	const host = bareHost(endpoint);
	if (host === homeHost) return { apiUrl: host, apiKey: homeKey };

	const usHost = bareHost(process.env.LANGSMITH_ENDPOINT_US ?? US_DEFAULT_ENDPOINT);
	if (host === usHost) {
		const usKey = process.env.LANGSMITH_API_KEY_US ?? '';
		if (!usKey) {
			throw new Error(
				`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.`,
			);
		}
		return { apiUrl: usHost, apiKey: usKey };
	}
	throw new Error(
		`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.`,
	);
}

/** Workspaces a key can access on a host. Returns [] on any failure so the
 *  caller falls back to the key's default workspace. */
async function listAccessibleWorkspaces(
	apiUrl: string,
	apiKey: string,
): Promise<Array<{ id: string; name: string }>> {
	if (!apiKey) return [];
	try {

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Export LANGSMITH_API_KEY_US with a key valid for the US tenant.
  2. 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.
  3. Ensure CI secrets include LANGSMITH_API_KEY_US whenever US-hosted traces are read.

Example fix

// before
$ export LANGSMITH_ENDPOINT=https://us.api.langsmith.com
$ export LANGSMITH_API_KEY=lsv2_home...
$ tsx run-eval  # seed.endpoint is US, no US key
// after
$ export LANGSMITH_ENDPOINT=https://us.api.langsmith.com
$ export LANGSMITH_API_KEY_US=lsv2_us...
$ tsx run-eval
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight env check before reading a US-hosted seed.
function assertTenantKeys(endpoint: string | undefined, homeHost: string, usHost: string): void {
  if (!endpoint) return;
  const host = bareHost(endpoint);
  if (host === usHost && !process.env.LANGSMITH_API_KEY_US) {
    throw new Error('LANGSMITH_API_KEY_US must be set to read US-hosted LangSmith traces.');
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/d62cbafec93271ca. Report an issue: GitHub.