{"record":{"id":"07ceea2512ca796f","repo":"charmbracelet/crush","slug":"no-workspace-config-path-configured","errorCode":null,"errorMessage":"no workspace config path configured","messagePattern":"no workspace config path configured","errorType":"exception","errorClass":"ErrNoWorkspaceConfig","httpStatus":null,"severity":"error","filePath":"internal/config/scope.go","lineNumber":29,"sourceCode":"\t// ScopeWorkspace targets the workspace config (.crush/crush.json).\n\tScopeWorkspace\n)\n\n// String returns a human-readable label for the scope.\nfunc (s Scope) String() string {\n\tswitch s {\n\tcase ScopeGlobal:\n\t\treturn \"global\"\n\tcase ScopeWorkspace:\n\t\treturn \"workspace\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"Scope(%d)\", int(s))\n\t}\n}\n\n// ErrNoWorkspaceConfig is returned when a workspace-scoped write is\n// attempted on a ConfigStore that has no workspace config path.\nvar ErrNoWorkspaceConfig = fmt.Errorf(\"no workspace config path configured\")\n","sourceCodeStart":11,"sourceCodeEnd":30,"githubUrl":"https://github.com/charmbracelet/crush/blob/7944b8e52225d8805e31eacbf7ef24856b0dfb7a/internal/config/scope.go#L11-L30","documentation":"ErrNoWorkspaceConfig is a sentinel error returned when a workspace-scoped write (SetConfigField/RemoveConfigField or configPath resolution) is attempted on a ConfigStore that has no workspace config path configured. The store can read/write global/project config, but workspace-scoped operations require an explicit workspace path.","triggerScenarios":"Calling configPath(ScopeWorkspace), SetConfigField, or RemoveConfigField with workspace scope on a ConfigStore constructed without a workspace config path (empty workspace path, e.g. outside a project or in tests).","commonSituations":"Running a workspace-scoped config edit when Crush was started without a project/workspace directory; constructing a ConfigStore in tests without setting the workspace path; tooling that assumes a workspace is always present.","solutions":["Open/initialize a workspace (run Crush inside a project directory) so the workspace config path is set.","Use global or project scope instead of workspace scope for the write.","Construct the ConfigStore with a valid workspace config path if you control its creation.","Check errors.Is(err, config.ErrNoWorkspaceConfig) and handle gracefully in tooling."],"exampleFix":"// before\nstore.SetConfigField(config.ScopeWorkspace, \"options.foo\", val)\n// after\nif store.HasWorkspaceConfig() {\n    store.SetConfigField(config.ScopeWorkspace, \"options.foo\", val)\n} else {\n    store.SetConfigField(config.ScopeProject, \"options.foo\", val)\n}","handlingStrategy":"type-guard","validationCode":"if store.WorkspaceConfigPath() == \"\" {\n    // use another scope or prompt user to open a workspace\n}","typeGuard":"func canWriteWorkspace(s *config.ConfigStore) bool {\n    err := s.SetConfigField(config.ScopeWorkspace, \"__probe\", true)\n    if errors.Is(err, config.ErrNoWorkspaceConfig) { return false }\n    _ = s.RemoveConfigField(config.ScopeWorkspace, \"__probe\")\n    return true\n}","tryCatchPattern":"err := store.SetConfigField(config.ScopeWorkspace, key, val)\nif errors.Is(err, config.ErrNoWorkspaceConfig) {\n    // fall back to project/global scope\n}","preventionTips":["Check errors.Is(err, config.ErrNoWorkspaceConfig) on workspace writes","Only offer workspace scope in the UI when a workspace is open","Initialize ConfigStore with a workspace path in tests that need it"],"tags":["config","workspace","sentinel-error"],"backgroundTag":"missing-config-path","analyzedSha":"7944b8e52225d8805e31eacbf7ef24856b0dfb7a","analyzedAt":"2026-08-29T12:48:59.079Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}