dagger/dagger · error
failed to set unstable flag %s in deno.json: %w
Error message
failed to set unstable flag %s in deno.json: %w
What it means
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.
Source
Thrown at sdk/typescript/runtime/tsutils/deno_config_updator.go:37
denoConfig = removeJSONComments(denoConfig)
// Add imports.typescript
denoConfig, err := setIfNotExists(denoConfig, "imports.typescript", "npm:typescript@"+tsdistconsts.DefaultTypeScriptVersion)
if err != nil {
return "", fmt.Errorf("failed to set typescript in deno.json")
}
// Add nodeModulesDir="auto"
denoConfig, err = sjson.Set(denoConfig, "nodeModulesDir", "auto")
if err != nil {
return "", fmt.Errorf("failed to update deno config nodeModulesDir: %w", err)
}
// Add unstable flags if they do not exist
for _, flag := range unstableFlags {
denoConfig, err = appendIfNotExists(denoConfig, "unstable", flag)
if err != nil {
return "", fmt.Errorf("failed to set unstable flag %s in deno.json: %w", flag, err)
}
}
return denoConfig, nil
}
func UpdateDenoConfigForModule(denoConfig string) (string, error) {
denoConfig, err := updateDenoConfigForDagger(denoConfig)
if err != nil {
return "", fmt.Errorf("failed to update deno config for dagger: %w", err)
}
// Add compilerOptions.experimentalDecorators=true
denoConfig, err = sjson.Set(denoConfig, "compilerOptions.experimentalDecorators", true)
if err != nil {
return "", fmt.Errorf("failed to update deno config experimentalDecorators: %w", err)
}
View on GitHub (pinned to 82ba2681db)
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.
Example fix
// before deno.json
{"unstable": true}
// after
{"unstable": ["raw-imports"]} Defensive patterns
Strategy: validation
Validate before calling
const cfg = JSON.parse(Deno.readTextFileSync('deno.json'));
if ('unstable' in cfg && !Array.isArray(cfg.unstable)) {
throw new Error('deno.json unstable must be an array of strings');
} Type guard
function unstableIsArray(cfg: Record<string, unknown>): cfg is { unstable: string[] } {
return !('unstable' in cfg) || Array.isArray(cfg.unstable);
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- failed to set typescript in deno.json
- failed to update deno config nodeModulesDir: %w
- failed to update deno config for dagger: %w
- failed to update deno config experimentalDecorators: %w
- failed to update deno.json
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/84d63b7a60cf86ff.
Report an issue: GitHub.