{"record":{"id":"805ebfbd42de59a7","repo":"ahmetb/kubectx","slug":"you-are-in-a-locked-single-context-shell-use-exi","errorCode":null,"errorMessage":"you are in a locked single-context shell, 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":19,"sourceCode":"package main\n\nimport (\n\t\"fmt\"\n\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":1,"sourceCodeEnd":25,"githubUrl":"https://github.com/ahmetb/kubectx/blob/12ad6fb22e8c546ee2b54e7de38aa51c906832f7/cmd/kubectx/isolated_shell_guard.go#L1-L25","documentation":"Guard error in checkIsolatedMode: the isolated-shell env var is set, but kc.Parse() failed, so the guard cannot even read the locked context name. It returns this generic message telling the user they are inside a locked single-context shell and modifications are blocked until they exit it.","triggerScenarios":"Thrown at cmd/kubectx/isolated_shell_guard.go:19 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Type 'exit' to leave the isolated shell before running kubectx mutations","Fix the underlying kubeconfig parse error if the shell should have started correctly"],"exampleFix":null,"handlingStrategy":"fallback","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"}