{"record":{"id":"232ab04cb6114e33","repo":"microsoft/aspire","slug":"qualified-deno-unstable-flags-must-start-with-unstable","errorCode":null,"errorMessage":"Qualified Deno unstable flags must start with \"--unstable-\".","messagePattern":"Qualified Deno unstable flags must start with \"--unstable-\"\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.JavaScript/DenoHostingExtensions.cs","lineNumber":265,"sourceCode":"    /// <returns>A reference to the <see cref=\"IResourceBuilder{T}\"/>.</returns>\n    /// <ats-returns>The resource builder.</ats-returns>\n    [AspireExport]\n    [Experimental(\"ASPIREDENO001\", UrlFormat = \"https://aka.ms/aspire/diagnostics/{0}\")]\n    public static IResourceBuilder<DenoAppResource> WithDenoUnstable(this IResourceBuilder<DenoAppResource> builder, params string[] features)\n    {\n        ArgumentNullException.ThrowIfNull(builder);\n        var annotation = GetOrAddDenoAnnotation(builder);\n        foreach (var feature in features ?? [])\n        {\n            if (string.IsNullOrEmpty(feature))\n            {\n                continue;\n            }\n\n            if (feature.StartsWith(\"--\", StringComparison.Ordinal) &&\n                !feature.StartsWith(\"--unstable-\", StringComparison.Ordinal))\n            {\n                throw new ArgumentException(\"Qualified Deno unstable flags must start with \\\"--unstable-\\\".\", nameof(features));\n            }\n\n            annotation.UnstableFlags.Add(feature.StartsWith(\"--unstable-\", StringComparison.Ordinal) ? feature : $\"--unstable-{feature}\");\n        }\n\n        return builder;\n    }\n\n    // ---- Watch / inspect --------------------------------------------------------------------\n\n    /// <summary>Enables <c>--watch</c> (or <c>--watch-hmr</c> when <paramref name=\"hmr\"/> is <see langword=\"true\"/>).</summary>\n    /// <param name=\"builder\">The Deno app resource builder.</param>\n    /// <param name=\"hmr\">Whether to emit <c>--watch-hmr</c> instead of <c>--watch</c>.</param>\n    /// <returns>A reference to the <see cref=\"IResourceBuilder{T}\"/>.</returns>\n    /// <ats-returns>The resource builder.</ats-returns>\n    [AspireExport]\n    [Experimental(\"ASPIREDENO001\", UrlFormat = \"https://aka.ms/aspire/diagnostics/{0}\")]\n    public static IResourceBuilder<DenoAppResource> WithDenoWatch(this IResourceBuilder<DenoAppResource> builder, bool hmr = false)","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.JavaScript/DenoHostingExtensions.cs#L247-L283","documentation":"WithDenoUnstable accepts either bare feature names ('foo' -> '--unstable-foo') or fully qualified flags ('--unstable-foo'). If a value starts with '--' but is not prefixed with '--unstable-', the library cannot safely normalize it and throws ArgumentException, since Deno would receive an unrelated flag.","triggerScenarios":"Calling WithDenoUnstable(\"--allow-net\") or any '--xyz' value lacking the '--unstable-' prefix; mixing other Deno flags into the unstable-features list.","commonSituations":"Copying a full Deno command line into WithDenoUnstable; config that stores complete flags rather than feature names; confusion between runtime args (WithDenoRuntimeArgs) and unstable features.","solutions":["Pass bare feature names: WithDenoUnstable(\"kv\", \"cron\") instead of \"--unstable-kv\".","If passing qualified flags, ensure each starts exactly with \"--unstable-\".","Move non-unstable flags to WithDenoRuntimeArgs instead.","Trim or validate the config list so generic '--' flags are routed to the right API."],"exampleFix":"// before\nresource.WithDenoUnstable(\"--sloppy-imports\");\n// after\nresource.WithDenoUnstable(\"sloppy-imports\");","handlingStrategy":"validation","validationCode":"if (features.Any(f => f.StartsWith(\"--\") && !f.StartsWith(\"--unstable-\"))) throw new ArgumentException(\"Unstable flags must be bare names or start with '--unstable-'.\");","typeGuard":"static bool IsValidUnstableFlag(string f) => !f.StartsWith(\"--\") || f.StartsWith(\"--unstable-\");","tryCatchPattern":"try { resource.WithDenoUnstable(features); } catch (ArgumentException ex) when (ex.ParamName == \"features\") { /* strip/rename offending flags */ }","preventionTips":["Store feature names without dashes in configuration","Keep unrelated flags in WithDenoRuntimeArgs","Normalize flag input at the config boundary"],"tags":["argument-exception","deno","flags","format"],"backgroundTag":"invalid-flag-value","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}