{"record":{"id":"aefa232e43418621","repo":"diegosouzapw/OmniRoute","slug":"the-model-omniroute-table-exists-and-omniroute-d","errorCode":null,"errorMessage":"The [model.omniroute] table exists and OmniRoute does not own it","messagePattern":"The \\[model\\.omniroute\\] table exists and OmniRoute does not own it","errorType":"validation","errorClass":"GrokBuildConfigConflictError","httpStatus":null,"severity":"error","filePath":"src/shared/services/grokBuildConfig.ts","lineNumber":229,"sourceCode":"  const section = parseModelSection(toml, GROK_MAIN_MODEL_SLOT);\n  if (!section) return false;\n  const body = getSectionBody(toml, `model.${GROK_MAIN_MODEL_SLOT}`) ?? \"\";\n  const keys = [...body.matchAll(/^\\s*([A-Za-z0-9_-]+)\\s*=/gm)].map((match) => match[1]);\n  const allowed = new Set([\"model\", \"base_url\", \"name\", \"description\", \"api_backend\", \"api_key\"]);\n  return (\n    keys.every((key) => allowed.has(key)) &&\n    section.model !== null &&\n    section.base_url !== null &&\n    section.name === \"OmniRoute\" &&\n    section.api_backend === \"chat_completions\" &&\n    getSectionString(toml, `model.${GROK_MAIN_MODEL_SLOT}`, \"description\") === LEGACY_DESCRIPTION\n  );\n};\n\nconst assertMainSlotOwnership = (toml: string): void => {\n  const body = getSectionBody(toml, `model.${GROK_MAIN_MODEL_SLOT}`);\n  if (body === null || body.includes(MANAGED_MARKER) || isLegacyOwnedMainSection(toml)) return;\n  throw new GrokBuildConfigConflictError();\n};\n\nexport class GrokBuildConfigConflictError extends Error {\n  constructor() {\n    super(\"The [model.omniroute] table exists and OmniRoute does not own it\");\n    this.name = \"GrokBuildConfigConflictError\";\n  }\n}\n\n/** Parse the Grok Build fields that OmniRoute manages. */\nexport function parseGrokBuildConfig(toml: string): GrokBuildSettings {\n  if (toml.trim()) parseToml(toml);\n  const subagentModels = {} as Record<GrokSubagentType, GrokModelConfig | null>;\n  const subagentMappings = {} as Record<GrokSubagentType, string | null>;\n  for (const type of GROK_SUBAGENT_TYPES) {\n    const mapping = getSectionString(toml, SUBAGENT_MODELS_SECTION, type);\n    subagentMappings[type] = mapping;\n    subagentModels[type] = mapping === modelSlot(type) ? parseModelSection(toml, mapping) : null;","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/shared/services/grokBuildConfig.ts#L211-L247","documentation":"Ownership conflict error during Grok config.toml management: a `[model.omniroute]` table exists whose content does not match the exact shape OmniRoute writes (unexpected keys, or wrong model/base_url/name/api_backend values). OmniRoute refuses to modify a table it does not own rather than silently clobbering user customizations.","triggerScenarios":"Thrown at src/shared/services/grokBuildConfig.ts:229 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Manually remove or rename the non-conforming [model.omniroute] table in config.toml, then re-apply","Move custom keys into a different table name so OmniRoute's slot stays canonical","Re-apply the Grok build config so OmniRoute rewrites the table in its own shape","Back up config.toml before editing"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}