{"record":{"id":"41cfb09dcd6fba2c","repo":"kopia/kopia","slug":"cannot-open-storage","errorCode":null,"errorMessage":"cannot open storage","messagePattern":"cannot open storage","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"repo/open.go","lineNumber":232,"sourceCode":"\t}\n\n\t// close on error to avoid leaking ref-counted resources\n\tif err2 := par.Close(ctx); err2 != nil {\n\t\terr = stderrors.Join(err, err2)\n\t}\n\n\treturn nil, err\n}\n\n// openDirect opens the repository that directly manipulates blob storage..\nfunc openDirect(ctx context.Context, configFile string, lc *LocalConfig, password string, options *Options) (rep Repository, err error) {\n\tif lc.Storage == nil {\n\t\treturn nil, errors.New(\"storage not set in the configuration file\")\n\t}\n\n\tst, err := blob.NewStorage(ctx, *lc.Storage, false)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"cannot open storage\")\n\t}\n\n\tif lc.ReadOnly {\n\t\tst = readonly.NewWrapper(st)\n\t}\n\n\tcliOpts := lc.ApplyDefaults(ctx, \"Repository in \"+st.DisplayName())\n\n\tr, err := openWithConfig(ctx, st, cliOpts, password, options, lc.Caching, configFile)\n\tif err != nil {\n\t\tst.Close(ctx) //nolint:errcheck\n\t\treturn nil, err\n\t}\n\n\treturn r, nil\n}\n\n// openWithConfig opens the repository with a given configuration, avoiding the need for a config file.","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/repo/open.go#L214-L250","documentation":"openDirect failed to instantiate the blob storage backend described in the repository config file: blob.NewStorage returned an error. This means the provider (filesystem, S3, B2, GCS, azure, sftp, rclone, webdav...) could not be constructed or connected — wrong credentials, unreachable endpoint, or unsupported/unknown provider type. No repository can be opened without storage.","triggerScenarios":"`kopia repository connect`/`open` where lc.Storage in the config references a backend whose parameters fail: bad access keys, nonexistent local path, unknown Type string, unreachable endpoint, or invalid TLS settings.","commonSituations":"S3 credentials expired or wrong region; filesystem path deleted/moved; config file edited by hand with an unknown provider type; network/firewall blocking the object store; provider plugin removed in a newer Kopia version.","solutions":["Inspect the wrapped cause for the provider-specific failure (auth, network, path)","Run `kopia repository set-client` / re-run `kopia connect <provider>` to regenerate storage config with valid parameters","Verify credentials, endpoints, bucket/container names, and local paths in kopia.config.json","Test the backend independently (aws s3 ls, az storage blob list, curl the endpoint) to isolate connectivity","Confirm the storage Type is one supported by your Kopia build/version"],"exampleFix":"// before\n\"storage\": {\"type\": \"s3\", \"config\": {\"bucket\": \"my-backups\", \"accessKeyID\": \"OLDKEY\"}}\n// after: reconnect to refresh credentials\n// $ kopia repository connect s3 --bucket=my-backups --access-key=NEWKEY --secret-access-key=...","handlingStrategy":"validation","validationCode":"// validate storage config before opening\nif cfg.Storage == nil || cfg.Storage.Type == \"\" {\n    return errors.New(\"storage not configured\")\n}\nif cfg.Storage.Type == \"filesystem\" {\n    if _, err := os.Stat(cfg.Storage.Path); err != nil {\n        return fmt.Errorf(\"storage path missing: %w\", err)\n    }\n}","typeGuard":null,"tryCatchPattern":"st, err := blob.NewStorage(ctx, *lc.Storage, false)\nif err != nil {\n    return fmt.Errorf(\"cannot open storage (check credentials/endpoint for %q): %w\", lc.Storage.Type, err)\n}","preventionTips":["Test backend connectivity/credentials independently before kopia connect","Never hand-edit the storage section of kopia.config.json; use `kopia connect`","Rotate credentials via re-connect, not by editing files"],"tags":["kopia","storage","blob","configuration","connectivity"],"backgroundTag":"invalid-config-value","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"}