{"record":{"id":"1188f96d1a96bce1","repo":"ahmetb/kubectx","slug":"you-are-in-a-locked-single-context-shell-s-u","errorCode":null,"errorMessage":"you are in a locked single-context shell (\"%s\"), use 'exit' to leave","messagePattern":"you are in a locked single-context shell \\(\"(.+?)\"\\), use 'exit' to leave","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kubectx/isolated_shell_guard.go","lineNumber":23,"sourceCode":"\t\"os\"\n\n\t\"github.com/ahmetb/kubectx/internal/env\"\n\t\"github.com/ahmetb/kubectx/internal/kubeconfig\"\n)\n\nfunc checkIsolatedMode() error {\n\tif os.Getenv(env.EnvIsolatedShell) != \"1\" {\n\t\treturn nil\n\t}\n\n\tkc := new(kubeconfig.Kubeconfig).WithLoader(kubeconfig.DefaultLoader)\n\tdefer kc.Close()\n\tif err := kc.Parse(); err != nil {\n\t\treturn fmt.Errorf(\"you are in a locked single-context shell, use 'exit' to leave\")\n\t}\n\n\tcur, _ := kc.GetCurrentContext()\n\treturn fmt.Errorf(\"you are in a locked single-context shell (\\\"%s\\\"), use 'exit' to leave\", cur)\n}\n","sourceCodeStart":5,"sourceCodeEnd":25,"githubUrl":"https://github.com/ahmetb/kubectx/blob/12ad6fb22e8c546ee2b54e7de38aa51c906832f7/cmd/kubectx/isolated_shell_guard.go#L5-L25","documentation":"Guard error in checkIsolatedMode: the isolated-shell env var is set and the kubeconfig parsed; the guard returns this message naming the currently locked context (cur), refusing the requested operation because kubectx must not change contexts while a scoped single-context shell is active.","triggerScenarios":"Thrown at cmd/kubectx/isolated_shell_guard.go:23 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Type 'exit' to leave the locked shell, then rerun the kubectx command"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"12ad6fb22e8c546ee2b54e7de38aa51c906832f7","analyzedAt":"2026-09-02T12:23:10.107Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}