{"record":{"id":"5a003f0e32f9c146","repo":"kopia/kopia","slug":"error-resolving-config-file-path","errorCode":null,"errorMessage":"error resolving config file path","messagePattern":"error resolving config file path","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"repo/open.go","lineNumber":121,"sourceCode":"\t\tif err != nil {\n\t\t\tlog(ctx).Errorf(\"failed to open repository: %v\", err)\n\t\t}\n\t}()\n\n\tif options == nil {\n\t\toptions = &Options{}\n\t}\n\n\tif options.OnFatalError == nil {\n\t\toptions.OnFatalError = func(err error) {\n\t\t\tlog(ctx).Errorf(\"FATAL: %v\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n\n\tconfigFile, err = filepath.Abs(configFile)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error resolving config file path\")\n\t}\n\n\tlc, err := LoadConfigFromFile(configFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif lc.PermissiveCacheLoading && !lc.ReadOnly {\n\t\treturn nil, ErrCannotWriteToRepoConnectionWithPermissiveCacheLoading\n\t}\n\n\tif lc.APIServer != nil {\n\t\treturn openAPIServer(ctx, lc.APIServer, lc.ClientOptions, lc.Caching, password, options)\n\t}\n\n\treturn openDirect(ctx, configFile, lc, password, options)\n}\n","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/repo/open.go#L103-L139","documentation":"Thrown by repo.Open when converting the provided config file path to an absolute path with filepath.Abs fails. This is a wrapper around a low-level OS/filesystem error and prevents the repository from being opened, since the configuration file location must be resolved before loading it.","triggerScenarios":"Calling repo.Open (or CLI `kopia repository connect`) with a config-file path that cannot be resolved — e.g. extremely long paths exceeding OS limits, or paths with components that fail during working-directory resolution on a broken/deleted CWD.","commonSituations":"Running kopia from a deleted working directory; KOPIA_CONFIG_PATH pointing at a path beyond PATH_MAX; containers with odd mount setups where os.Getwd fails.","solutions":["Check the wrapped OS error; on Linux it is usually 'file name too long' or 'no such file or directory' for the CWD.","Pass a shorter, absolute config path directly instead of relying on CWD resolution.","Ensure the process's current working directory exists before calling Open.","Set KOPIA_CONFIG_PATH to a valid absolute path and retry."],"exampleFix":"// before: relative path from possibly-deleted CWD\nrep, _ := repo.Open(ctx, \"./config/repo.config\", pass, opts)\n// after: absolute path\nabs, _ := filepath.Abs(\"./config/repo.config\") // or hardcode /etc/kopia/repository.config\nrep, _ := repo.Open(ctx, abs, pass, opts)","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(configFile); err != nil { return fmt.Errorf(\"config path unusable: %w\", err) }\nif len(configFile) > 4000 { return errors.New(\"config path too long\") }","typeGuard":"func configPathOk(p string) bool { return filepath.IsAbs(p) && len(p) < 4000 }","tryCatchPattern":"rep, err := repo.Open(ctx, configFile, pass, opts)\nif err != nil && strings.Contains(err.Error(), \"error resolving config file path\") {\n    return fmt.Errorf(\"check KOPIA_CONFIG_PATH and current working directory: %w\", err)\n}","preventionTips":["Always pass absolute config paths.","Set KOPIA_CONFIG_PATH explicitly in scripts and containers.","Avoid running from working directories that may be deleted (common in long-running daemons)."],"tags":["config","filesystem","path"],"backgroundTag":"file-not-found","analyzedSha":"82495e54b584c1ef6073c9e1be048f57f8aef078","analyzedAt":"2026-09-07T20:35:21.689Z","contentChangedAt":"2026-09-07T20:35:21.689Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}