{"record":{"id":"c0ca2cfccf7d5aa0","repo":"Yeachan-Heo/oh-my-codex","slug":"refusing-to-write-invalid-planned-config-toml-e","errorCode":null,"errorMessage":"Refusing to write invalid planned config.toml: ${error instanceof Error ? error.message : String(error)}","messagePattern":"Refusing to write invalid planned config\\.toml: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/setup.ts","lineNumber":3906,"sourceCode":"\t\t\t\t\tnotifyPlan.metadataPath,\n\t\t\t\t\t`notification metadata ${notifyPlan.metadataPath}`,\n\t\t\t\t\tmetadataBefore,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!options.disableHooks && options.isPluginInstallMode && options.sharedMcpRegistry.servers.length > 0) {\n\t\tfinalConfig = mergeSharedMcpRegistryBlock(\n\t\t\tfinalConfig,\n\t\t\toptions.sharedMcpRegistry.servers,\n\t\t\toptions.sharedMcpRegistry.sourcePath,\n\t\t);\n\t}\n\ttry {\n\t\tTOML.parse(finalConfig);\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Refusing to write invalid planned config.toml: ${error instanceof Error ? error.message : String(error)}`,\n\t\t);\n\t}\n\n\tconst hookArtifact = nativeHookTransactionArtifact(\n\t\t\"hooks\",\n\t\toptions.hooksPath,\n\t\t`native hooks ${options.hooksPath}`,\n\t\texistingHooksSnapshot,\n\t\tfinalHooksContent === null ? null : Buffer.from(finalHooksContent, \"utf-8\"),\n\t\toptions.platform,\n\t);\n\tconst configArtifact = nativeHookTransactionArtifact(\n\t\t\"config\",\n\t\toptions.configPath,\n\t\t`config ${options.configPath}`,\n\t\texistingConfigSnapshot,\n\t\tBuffer.from(finalConfig, \"utf-8\"),","sourceCodeStart":3888,"sourceCodeEnd":3924,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/setup.ts#L3888-L3924","documentation":"After composing the final config.toml, the planner re-parses it with TOML.parse as a safety check; the generated TOML is invalid, so it refuses to write a broken config. The parser's message explains the syntax problem.","triggerScenarios":"User config content (e.g. a pre-existing notify command, MCP entries, or string values containing newlines/quotes) gets serialized into TOML that fails to round-trip through the TOML parser.","commonSituations":"Multi-line or unescaped special characters in existing config values, exotic TOML from an older Codex version, or a serialization bug in OMX itself.","solutions":["Inspect the generated config for unescaped quotes/newlines in string values; simplify the offending entry in your original config.toml","Report the issue to OMX maintainers with your (redacted) config.toml — a valid input config should always round-trip","As a workaround, remove/rename the problematic config section and re-run setup, then re-add it manually"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import TOML from '@iarna/toml';\ntry { TOML.parse(readFileSync(configPath, 'utf8')); } catch { /* sanitize or fix config before running setup */ }","typeGuard":null,"tryCatchPattern":"catch (e) { if (String(e).startsWith('Refusing to write invalid planned config.toml')) { /* inspect config values with quotes/newlines; report bug */ } else throw e; }","preventionTips":["Keep config.toml values simple (single-line, escaped quotes)","Report round-trip failures upstream with the offending (redacted) config"],"tags":["toml","config","serialization","round-trip"],"backgroundTag":"toml-parse-error","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}