{"id":"923a2d330817fe99","repo":"docker/cli","slug":"path-q-is-outside-of-root-config-directory-q","errorCode":null,"errorMessage":"path %q is outside of root config directory %q","messagePattern":"path %q is outside of root config directory %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/config/config.go","lineNumber":103,"sourceCode":"}\n\n// ContextStoreDir returns the directory the docker contexts are stored in\nfunc ContextStoreDir() string {\n\treturn filepath.Join(Dir(), contextsDir)\n}\n\n// SetDir sets the directory the configuration file is stored in\nfunc SetDir(dir string) {\n\t// trigger the sync.Once to synchronise with Dir()\n\tinitConfigDir.Do(func() {})\n\tconfigDir = filepath.Clean(dir)\n}\n\n// Path returns the path to a file relative to the config dir\nfunc Path(p ...string) (string, error) {\n\tpath := filepath.Join(append([]string{Dir()}, p...)...)\n\tif !strings.HasPrefix(path, Dir()+string(filepath.Separator)) {\n\t\treturn \"\", fmt.Errorf(\"path %q is outside of root config directory %q\", path, Dir())\n\t}\n\treturn path, nil\n}\n\n// LoadFromReader is a convenience function that creates a ConfigFile object from\n// a reader. It returns an error if configData is malformed.\nfunc LoadFromReader(configData io.Reader) (*configfile.ConfigFile, error) {\n\tconfigFile := configfile.ConfigFile{\n\t\tAuthConfigs: make(map[string]types.AuthConfig),\n\t}\n\terr := configFile.LoadFromReader(configData)\n\treturn &configFile, err\n}\n\n// Load reads the configuration file ([ConfigFileName]) from the given directory.\n// If no directory is given, it uses the default [Dir]. A [*configfile.ConfigFile]\n// is returned containing the contents of the configuration file, or a default\n// struct if no configfile exists in the given location.","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/config/config.go#L85-L121","documentation":"Error \"path %q is outside of root config directory %q\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/config/config.go:103 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}