n8n-io/n8n · error · Error

LangSmith workspace "${name}" not found among [${workspaces.

Error message

LangSmith workspace "${name}" not found among [${workspaces.map((w) => w.name).join(', ')}]. Check LANGSMITH_API_KEY (org PAT) + LANGSMITH_ENDPOINT (region).

What it means

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.

Source

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

		});
	} catch {
		return [];
	}
}

/** Workspace eval writes are pinned to; resolved to an id by name so no UUID lives in the repo. */
export const EVAL_WORKSPACE_NAME = 'Staging';

/** Eval workspace id by name; undefined for a workspace-scoped key (already locked to one), throws when a PAT lacks it. */
export async function resolveEvalWorkspaceId(
	name: string = EVAL_WORKSPACE_NAME,
): Promise<string | undefined> {
	const { apiUrl, apiKey } = configFor();
	const workspaces = await listAccessibleWorkspaces(apiUrl, apiKey);
	const match = workspaces.find((w) => w.name === name);
	if (match) return match.id;
	if (workspaces.length <= 1) return undefined; // scoped/single-workspace key: nothing to choose
	throw new Error(
		`LangSmith workspace "${name}" not found among [${workspaces.map((w) => w.name).join(', ')}]. Check LANGSMITH_API_KEY (org PAT) + LANGSMITH_ENDPOINT (region).`,
	);
}

/** Seams for unit-testing workspace discovery without the network. */
export interface SeedDiscoveryDeps {
	listWorkspaces: () => Promise<Array<{ id: string; name: string }>>;
	clientForWorkspace: (workspaceId: string) => Client;
	ambientClient: () => Client;
}

/** Build discovery deps bound to one tenant (host + key resolved from the seed
 *  ref's endpoint). All three seams target that host, so cross-workspace
 *  discovery stays within the chosen tenant. */
function discoveryDepsFor(endpoint?: string): SeedDiscoveryDeps {
	const { apiUrl, apiKey } = configFor(endpoint);
	return {
		listWorkspaces: async () => await listAccessibleWorkspaces(apiUrl, apiKey),

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Provision LANGSMITH_API_KEY as an org PAT whose workspaces include 'Staging'.
  2. Confirm LANGSMITH_ENDPOINT region matches the key (a US key against the home endpoint shows the wrong workspaces).
  3. If the workspace was renamed, update EVAL_WORKSPACE_NAME or create a 'Staging' workspace.
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight: confirm the Staging workspace is reachable before writing.
const workspaces = await listAccessibleWorkspaces(apiUrl, apiKey);
if (workspaces.length > 1 && !workspaces.some((w) => w.name === EVAL_WORKSPACE_NAME)) {
  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.`);
}

Prevention

When it happens

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

Common situations: Org PAT missing the Staging workspace; region mismatch (US key against home endpoint); workspace renamed since the eval was configured.

Related errors


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