can1357/oh-my-pi · error · AIError.ConfigurationError
OMP_AUTH_BROKER_ACCOUNT_POOL_FILE contains a provider id wit
Error message
OMP_AUTH_BROKER_ACCOUNT_POOL_FILE contains a provider id with surrounding whitespace
What it means
Provider ids in the pool file must not have leading or trailing whitespace. The loader trims each key for the emptiness check but then requires the raw key to equal its trimmed form; " openai" or "anthropic " is rejected with this ConfigurationError. This catches hand-edited or machine-generated files where stray spaces would silently break provider matching.
Source
Thrown at packages/ai/src/auth-broker/discover.ts:141
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`,
);
}
if (identity !== identity.trim()) {
throw new AIError.ConfigurationError(
`OMP_AUTH_BROKER_ACCOUNT_POOL_FILE entry for ${provider} contains an identity key with surrounding whitespace`,View on GitHub (pinned to 9690622007)
Solutions
- Edit the pool file and remove the leading/trailing whitespace from the offending key.
- Run a check: `jq 'keys | map(select(. != (| . | trim)))' pool.json` (or compare keys to trimmed keys in a script) and fix all listed keys.
- Fix the generating template/script so it trims provider ids before serializing.
Example fix
// before (account-pool.json)
{
" openai ": ["acc1"]
}
// after
{
"openai": ["acc1"]
} Defensive patterns
Strategy: validation
Validate before calling
function validateNoWhitespaceKeys(pool: Record<string, unknown>): void {
for (const key of Object.keys(pool)) {
if (key !== key.trim()) {
throw new Error(`provider key has surrounding whitespace: ${JSON.stringify(key)}`);
}
}
} Type guard
function keysAreTrimmed(v: Record<string, unknown>): boolean {
return Object.keys(v).every((k) => k === k.trim());
} Try / catch
try {
const pool = await loadAuthBrokerAccountPool();
} catch (err) {
if (err instanceof AIError.ConfigurationError && err.message.includes("surrounding whitespace")) {
logger.error("pool file provider key has surrounding whitespace; strip it in the file");
} else throw err;
} Prevention
- Trim provider ids in any script that composes the pool file before serialization.
- Validate keys in CI: compare Object.keys(pool) with their trimmed versions.
- Avoid manual edits to machine-managed JSON; regenerate instead.
- Watch for templating tools that append trailing spaces inside interpolated keys.
When it happens
Trigger: OMP_AUTH_BROKER_ACCOUNT_POOL_FILE has a provider key like " openai" or "anthropic\t" (leading/trailing space or tab around the key).
Common situations: Manual JSON editing that introduced a stray space; templating that interpolated "provider " with a trailing space; generators joining strings with unintended separators.
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
- OMP_AUTH_BROKER_ACCOUNT_POOL_FILE contains an empty provider
- OAuth redirect URI must not include surrounding whitespace
- OAuth resource URI must not include surrounding whitespace
- OMP_AUTH_BROKER_ACCOUNT_POOL_FILE must contain a JSON object
- OMP_AUTH_BROKER_ACCOUNT_POOL_FILE entry for ${provider} must
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/6bb045014574e80a.
Report an issue: GitHub.