{"record":{"id":"14805b27e6afe135","repo":"microsoft/aspire","slug":"aspireradius059","errorCode":"ASPIRERADIUS059","errorMessage":"Could not resolve the active Radius workspace kube-context from '{attemptedConfigPath}'. Configure the active rad workspace, or set {KubeContextOverrideEnvironmentVariable} to the kubectl context that targets the same cluster before re-running deploy. Diagnostic: ASPIRERADIUS059.","messagePattern":"Could not resolve the active Radius workspace kube-context from '(.+?)'\\. Configure the active rad workspace, or set (.+?) to the kubectl context that targets the same cluster before re-running deploy\\. Diagnostic: ASPIRERADIUS059\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Radius/Publishing/SealedSecretApplyStep.cs","lineNumber":690,"sourceCode":"    // shared resolver so this step and the control plane version gate can never disagree about\n    // which cluster is being inspected. Kept as a forwarder because the parsing behavior is\n    // exercised directly by SealedSecretApplyStepTests.\n    internal static string? ParseActiveWorkspaceContext(string text) =>\n        RadiusWorkspaceKubeContext.ParseActiveWorkspaceContext(text);\n\n    internal static string RequireKubeContext(string? overrideContext, string? parsedContext, string attemptedConfigPath)\n    {\n        if (!string.IsNullOrWhiteSpace(overrideContext))\n        {\n            return overrideContext.Trim();\n        }\n\n        if (!string.IsNullOrWhiteSpace(parsedContext))\n        {\n            return parsedContext.Trim();\n        }\n\n        throw new InvalidOperationException(\n            $\"Could not resolve the active Radius workspace kube-context from '{attemptedConfigPath}'. Configure \" +\n            $\"the active rad workspace, or set {KubeContextOverrideEnvironmentVariable} to the kubectl context \" +\n            \"that targets the same cluster before re-running deploy. Diagnostic: ASPIRERADIUS059.\");\n    }\n\n    private static async Task<bool> DetectKubectlAsync(CancellationToken cancellationToken)\n    {\n        try\n        {\n            using var process = new Process\n            {\n                StartInfo = new ProcessStartInfo\n                {\n                    FileName = \"kubectl\",\n                    ArgumentList = { \"version\", \"--client\" },\n                    RedirectStandardOutput = true,\n                    RedirectStandardError = true,\n                    UseShellExecute = false,","sourceCodeStart":672,"sourceCodeEnd":708,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Radius/Publishing/SealedSecretApplyStep.cs#L672-L708","documentation":"The step needs the kubectl context of the active Radius workspace to target the right cluster for SealedSecret operations. It parses the rad config at attemptedConfigPath; if no active workspace context (or it is blank) is found, ASPIRERADIUS059 is thrown, pointing to `rad workspace` configuration or the KubeContextOverrideEnvironmentVariable override.","triggerScenarios":"RequireKubeContext (invoked while resolving kubeContext) finds parsedContext null/whitespace after reading the rad config file — no active rad workspace is configured, or the workspace entry lacks a kube-context, and no override env var is set.","commonSituations":"Fresh machine or CI runner where `rad workspace switch` was never run; multiple rad workspaces with none active; rad config at a non-default path passed explicitly but pointing at a workspace without a context; deployment to a cluster different from the rad default requiring an explicit override.","solutions":["Set the override env var (see KubeContextOverrideEnvironmentVariable in the message) to the kubectl context that targets the same cluster, then re-run deploy.","Configure the active workspace: `rad workspace switch <workspace>` (and `rad init` if none exists) so the rad config has a kube-context.","Inspect the rad config file named in the error and confirm the active workspace entry has a non-empty context."],"exampleFix":"// before\nrad deploy app.bicep   # no active rad workspace context\n\n// after\nexport ASPIRE_RADIUS_KUBE_CONTEXT_OVERRIDE=my-cluster-context  # or: rad workspace switch my-workspace\nrad deploy app.bicep","handlingStrategy":"validation","validationCode":"// Pre-flight: resolve the kube context the same way the step does\nvar radConfig = File.ReadAllText(radConfigPath);\nif (!radConfig.Contains(\"kubeContext\") || string.IsNullOrWhiteSpace(ExtractContext(radConfig)))\n    Environment.SetEnvironmentVariable(\"ASPIRE_RADIUS_KUBE_CONTEXT_OVERRIDE\", \"my-cluster-context\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `rad workspace switch` (or `rad init`) on every machine/CI runner before deploying.","Set the kube-context override env var explicitly in pipelines that target a known cluster.","Keep the rad config and kubeconfig consistent — the override context must target the same cluster as the rad workspace."],"tags":["radius","kubeconfig","configuration","deploy"],"backgroundTag":"missing-config-value","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}