farion1231/cc-switch · error · Error
Grok Build official provider was not created
Error message
Grok Build official provider was not created
What it means
Thrown inside useAddProviderMutation's mutationFn when appId is 'grokbuild' with ensureGrokBuildOfficialSeed set: ensureGrokBuildOfficialProvider() runs, then providers[GROKBUILD_OFFICIAL_PROVIDER_ID] must exist. Its absence means the Grok Build official seed was not created or not returned - an invariant break, not a user-input error.
Source
Thrown at src/lib/query/mutations.ts:90
return nativeLoginProvider;
}
const managedOfficialProvider: Provider = {
...rest,
id: generateUUID(),
category: "official",
createdAt: Date.now(),
};
await providersApi.add(managedOfficialProvider, appId, addToLive);
return managedOfficialProvider;
}
if (appId === "grokbuild" && ensureGrokBuildOfficialSeed) {
await providersApi.ensureGrokBuildOfficialProvider();
const providers = await providersApi.getAll(appId);
const officialProvider = providers[GROKBUILD_OFFICIAL_PROVIDER_ID];
if (!officialProvider) {
throw new Error("Grok Build official provider was not created");
}
return officialProvider;
}
let id: string;
if (
appId === "opencode" ||
appId === "openclaw" ||
appId === "hermes" ||
appId === "pi"
) {
if (
providerInput.category === "omo" ||
providerInput.category === "omo-slim"
) {
const prefix = providerInput.category === "omo" ? "omo" : "omo-slim";
id = `${prefix}-${generateUUID()}`;View on GitHub (pinned to a2e22f3302)
Solutions
- Check the ensureGrokBuildOfficialProvider backend command logs for a silent early return
- Retry the mutation once to clear a transient race
- Confirm getAll('grokbuild') contains the GROKBUILD_OFFICIAL_PROVIDER_ID key after a manual ensure
Example fix
// before
await providersApi.ensureGrokBuildOfficialProvider();
const official = (await providersApi.getAll(appId))[GROKBUILD_OFFICIAL_PROVIDER_ID];
if (!official) throw new Error("Grok Build official provider was not created");
// after
await providersApi.ensureGrokBuildOfficialProvider();
let official: Provider | undefined;
for (let i = 0; i < 3 && !official; i++) {
await new Promise((r) => setTimeout(r, 100 * (i + 1)));
official = (await providersApi.getAll(appId))[GROKBUILD_OFFICIAL_PROVIDER_ID];
}
if (!official) throw new Error("Grok Build official provider was not created"); Defensive patterns
Strategy: retry
Validate before calling
// Skip the ensure path when the official provider already exists
const existing = (await providersApi.getAll("grokbuild"))[GROKBUILD_OFFICIAL_PROVIDER_ID];
if (existing) {
return existing;
} Try / catch
try {
return await addProvider.mutateAsync(input);
} catch (e) {
if (e instanceof Error && e.message === "Grok Build official provider was not created") {
await queryClient.invalidateQueries({ queryKey: providersKeys.all });
return await addProvider.mutateAsync(input); // one retry after cache refresh
}
throw e;
} Prevention
- Check for the official provider before invoking the ensure seed path
- Log the returned provider map keys when the invariant fails
- Confirm the backend build actually supports the grokbuild seed command
When it happens
Trigger: mutateAsync({ appId: 'grokbuild', providerInput: { ensureGrokBuildOfficialSeed: true, ... } }) where the ensure command no-ops or getAll('grokbuild') lacks the GROKBUILD_OFFICIAL_PROVIDER_ID key.
Common situations: First-run seeding on a fresh data dir; backend not yet supporting the grokbuild seed; race between the ensure write and the provider list read.
Related errors
- Claude Desktop official provider was not created
- Codex current-login provider was not created
- Provider key is required for ${appId}
- jsonEditor.mustBeObject
AI-assisted analysis of farion1231/cc-switch@a2e22f3302 (2026-08-16).
Data as JSON: /api/errors/32fdfd821c6e162f.
Report an issue: GitHub.