{"record":{"id":"84d63b7a60cf86ff","repo":"dagger/dagger","slug":"failed-to-set-unstable-flag-s-in-deno-json-w","errorCode":null,"errorMessage":"failed to set unstable flag %s in deno.json: %w","messagePattern":"failed to set unstable flag (.+?) in deno\\.json: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/typescript/runtime/tsutils/deno_config_updator.go","lineNumber":37,"sourceCode":"\tdenoConfig = removeJSONComments(denoConfig)\n\n\t// Add imports.typescript\n\tdenoConfig, err := setIfNotExists(denoConfig, \"imports.typescript\", \"npm:typescript@\"+tsdistconsts.DefaultTypeScriptVersion)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to set typescript in deno.json\")\n\t}\n\n\t// Add nodeModulesDir=\"auto\"\n\tdenoConfig, err = sjson.Set(denoConfig, \"nodeModulesDir\", \"auto\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to update deno config nodeModulesDir: %w\", err)\n\t}\n\n\t// Add unstable flags if they do not exist\n\tfor _, flag := range unstableFlags {\n\t\tdenoConfig, err = appendIfNotExists(denoConfig, \"unstable\", flag)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to set unstable flag %s in deno.json: %w\", flag, err)\n\t\t}\n\t}\n\n\treturn denoConfig, nil\n}\n\nfunc UpdateDenoConfigForModule(denoConfig string) (string, error) {\n\tdenoConfig, err := updateDenoConfigForDagger(denoConfig)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to update deno config for dagger: %w\", err)\n\t}\n\n\t// Add compilerOptions.experimentalDecorators=true\n\tdenoConfig, err = sjson.Set(denoConfig, \"compilerOptions.experimentalDecorators\", true)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to update deno config experimentalDecorators: %w\", err)\n\t}\n","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/sdk/typescript/runtime/tsutils/deno_config_updator.go#L19-L55","documentation":"While iterating the unstableFlags list, appendIfNotExists failed to add a flag (e.g. the `unstable` field in deno.json is not an array) to the deno.json content. The error names the specific flag and wraps the underlying cause.","triggerScenarios":"updateDenoConfigForDagger processing a deno.json where the `unstable` key exists but holds a non-array value (string, object, null), causing appendIfNotExists/sjson array append to fail.","commonSituations":"Manually setting `\"unstable\": true` or a string instead of an array in deno.json; older Deno config formats where unstable flags were booleans; copy-pasted config from Deno docs using deprecated boolean style.","solutions":["Change `unstable` in deno.json to an array of strings, e.g. {\"unstable\": [\"raw-imports\"]}.","Remove the `unstable` key entirely and let Dagger recreate it with the required flags.","Re-run `dagger develop` to regenerate a correct deno.json.","Verify after editing: `deno check` / JSON linter accepts the file."],"exampleFix":"// before deno.json\n{\"unstable\": true}\n// after\n{\"unstable\": [\"raw-imports\"]}","handlingStrategy":"validation","validationCode":"const cfg = JSON.parse(Deno.readTextFileSync('deno.json'));\nif ('unstable' in cfg && !Array.isArray(cfg.unstable)) {\n  throw new Error('deno.json unstable must be an array of strings');\n}","typeGuard":"function unstableIsArray(cfg: Record<string, unknown>): cfg is { unstable: string[] } {\n  return !('unstable' in cfg) || Array.isArray(cfg.unstable);\n}","tryCatchPattern":null,"preventionTips":["Express unstable flags as a string array, never a boolean/string","Let Dagger manage the unstable field","Update to current Deno config style after Deno version upgrades"],"tags":["dagger","deno","json-mutation"],"backgroundTag":"deno-config-update-failed","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}