can1357/oh-my-pi · error · AIError.ConfigurationError

OMP_AUTH_BROKER_ACCOUNT_POOL_FILE contains an empty provider

Error message

OMP_AUTH_BROKER_ACCOUNT_POOL_FILE contains an empty provider id

What it means

Each top-level key of the pool object is a provider id. If a key trims to the empty string (i.e. the key is empty or entirely whitespace), the loader throws this ConfigurationError. Empty provider ids cannot be matched against any real provider and indicate a malformed pool file.

Source

Thrown at packages/ai/src/auth-broker/discover.ts:138

	if (!filePath) return undefined;

	let parsed: unknown;
	try {
		parsed = await Bun.file(filePath).json();
	} catch (error) {
		throw new AIError.ConfigurationError(`Unable to read OMP_AUTH_BROKER_ACCOUNT_POOL_FILE at ${filePath}`, {
			cause: error,
		});
	}
	if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
		throw new AIError.ConfigurationError("OMP_AUTH_BROKER_ACCOUNT_POOL_FILE must contain a JSON object");
	}

	const accountPool = new Map<string, ReadonlySet<string>>();
	for (const [provider, value] of Object.entries(parsed)) {
		const normalizedProvider = provider.trim();
		if (normalizedProvider.length === 0) {
			throw new AIError.ConfigurationError("OMP_AUTH_BROKER_ACCOUNT_POOL_FILE contains an empty provider id");
		}
		if (provider !== normalizedProvider) {
			throw new AIError.ConfigurationError(
				"OMP_AUTH_BROKER_ACCOUNT_POOL_FILE contains a provider id with surrounding whitespace",
			);
		}
		if (!Array.isArray(value)) {
			throw new AIError.ConfigurationError(
				`OMP_AUTH_BROKER_ACCOUNT_POOL_FILE entry for ${provider} must be an array of identity keys`,
			);
		}
		const identities = new Set<string>();
		for (const identity of value) {
			if (typeof identity !== "string" || identity.length === 0) {
				throw new AIError.ConfigurationError(
					`OMP_AUTH_BROKER_ACCOUNT_POOL_FILE entry for ${provider} contains an invalid identity key`,
				);
			}

View on GitHub (pinned to 9690622007)

Solutions

  1. Open the pool file and remove the empty or whitespace-only key (JSON linters/`jq keys` help spot it).
  2. Fix the generator so the provider id variable is populated before writing the file.
  3. Validate the file before use: `jq 'keys | map(select(ltrimstr(" ") | length == 0))'` should list nothing.

Example fix

// before (account-pool.json)
{
  "": ["acc1"]
}

// after
{
  "openai": ["acc1"]
}
Defensive patterns

Strategy: validation

Validate before calling

function validateProviderKeys(pool: Record<string, unknown>): void {
  for (const key of Object.keys(pool)) {
    if (key.trim().length === 0) {
      throw new Error(`pool file contains empty provider key: ${JSON.stringify(key)}`);
    }
  }
}

Type guard

function hasNoEmptyProviderKeys(v: Record<string, unknown>): boolean {
  return Object.keys(v).every((k) => k.trim().length > 0);
}

Try / catch

try {
  const pool = await loadAuthBrokerAccountPool();
} catch (err) {
  if (err instanceof AIError.ConfigurationError && err.message.includes("empty provider id")) {
    logger.error("pool file has an empty provider key; remove it and regenerate");
  } else throw err;
}

Prevention

When it happens

Trigger: OMP_AUTH_BROKER_ACCOUNT_POOL_FILE contains a JSON object with a key that is "" or whitespace-only (e.g. "": [...] or " ": [...]).

Common situations: Template/template-substitution failure that left an empty provider placeholder key; programmatic generation using an undefined variable as the key; copy-paste of a JSON snippet with an accidental empty key.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/a0bc8ab94cf873a6. Report an issue: GitHub.