{"record":{"id":"69f931c13953c8ab","repo":"dagger/dagger","slug":"render-config-after-delete-w","errorCode":null,"errorMessage":"render config after delete: %w","messagePattern":"render config after delete: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/workspace/config.go","lineNumber":864,"sourceCode":"\ttree, err := toml.LoadBytes(existingData)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parse existing config: %w\", err)\n\t}\n\tif tree.GetPath(parts) == nil {\n\t\treturn nil, fmt.Errorf(\"key %q is not set\", key)\n\t}\n\n\tcollapsed := collapseEmptiedConfigTables(tree, parts)\n\n\tif configPathRequiresSerializeFallback(collapsed) {\n\t\t// Same trade-off as writes: document edits can't address quoted or\n\t\t// all-digit path segments, so fall back to a full canonical rewrite.\n\t\tif err := tree.DeletePath(collapsed); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"delete config path %q: %w\", JoinConfigPath(collapsed...), err)\n\t\t}\n\t\trendered, err := tree.ToTomlString()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"render config after delete: %w\", err)\n\t\t}\n\t\tcfg, err := ParseConfig([]byte(rendered))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn SerializeConfig(cfg), nil\n\t}\n\n\treturn deleteConfigDocumentPath(existingData, parts, collapsed)\n}\n\n// refuseProtectedConfigDelete rejects keys whose removal would break the\n// containing entry rather than merely unset a value.\nfunc refuseProtectedConfigDelete(parts []string, key string) error {\n\tswitch {\n\tcase parts[0] == \"ports\":\n\t\treturn fmt.Errorf(\"cannot unset %q; edit or remove the [ports.<host>] section in dagger.toml\", key)\n\tcase parts[0] == \"modules\" && len(parts) >= 3 && parts[2] == \"source\":","sourceCodeStart":846,"sourceCodeEnd":882,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/workspace/config.go#L846-L882","documentation":"DeleteConfigValue removes a key from dagger.toml and, when the key path contains quoted or all-digit segments that document-level edits cannot address, falls back to deleting from the parsed TOML tree and re-rendering the whole file. This error wraps a failure of that re-render (ToTomlString), meaning the in-memory TOML tree could not be serialized back to text after the deletion. It indicates an internal serialization problem with the tree produced by the TOML library, not a problem with the key the user asked to delete.","triggerScenarios":"Calling DeleteConfigValue (directly or via withoutConfigValue) on a key whose collapsed path contains a segment that is quoted or all-digit (configPathRequiresSerializeFallback returns true), the tree.DeletePath succeeds, but tree.ToTomlString fails to render the modified TOML document.","commonSituations":"Very rare in practice: dagger.toml containing TOML constructs the renderer cannot round-trip (exotic value types), or a corrupted/corner-case TOML tree left by a third-party edit; typically surfaces as a bug report rather than a user mistake.","solutions":["Retry the delete; if it reproduces, file a bug with the dagger.toml contents attached.","Manually edit dagger.toml to remove the key, removing any unusual TOML value types or formatting first.","Restore dagger.toml from version control or backup and re-apply edits incrementally.","Run `dagger config read`/parse the file with a TOML linter to identify the construct that fails to round-trip."],"exampleFix":"// before: dagger.toml contains a value type the renderer cannot emit\ndagger config delete 'weird.\"quoted\".key'\n// error: render config after delete: ...\n\n// after: normalize the odd construct by hand, then delete\n# edit dagger.toml: replace exotic value with a plain scalar, save\n# then re-run the delete\ndagger config delete 'weird.\"quoted\".key'","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"rendered, err := DeleteConfigValue(ctx, key)\nif err != nil {\n    if strings.Contains(err.Error(), \"render config after delete\") {\n        // renderer failed to round-trip the TOML tree\n        return fmt.Errorf(\"dagger.toml could not be re-serialized after delete; edit the file manually: %w\", err)\n    }\n    return err\n}","preventionTips":["Keep dagger.toml to plain, standard TOML constructs that round-trip cleanly.","Commit dagger.toml so any failed delete can be reverted with git checkout.","Treat this error as a bug: capture the file and report it upstream."],"tags":["toml","config","serialization","dagger"],"backgroundTag":"toml-serialization-failed","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}