{"record":{"id":"f7e0a9599cb7b94e","repo":"kopia/kopia","slug":"one-of-file-token-file-token-stdin-or-to","errorCode":null,"errorMessage":"one of --file, --token-file, --token-stdin or --token must be provided","messagePattern":"one of --file, --token-file, --token-stdin or --token must be provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command_repository_connect_from_config.go","lineNumber":56,"sourceCode":"\t}\n\n\tif c.connectFromConfigToken != \"\" {\n\t\treturn c.connectToStorageFromConfigToken(ctx, c.connectFromConfigToken)\n\t}\n\n\tif c.connectFromTokenFile != \"\" {\n\t\treturn c.connectToStorageFromStorageConfigFile(ctx)\n\t}\n\n\tif c.connectFromTokenStdin {\n\t\treturn c.connectToStorageFromStorageConfigStdin(ctx)\n\t}\n\n\tif isCreate {\n\t\treturn nil, errors.New(\"one of --token-file, --token-stdin or --token must be provided\")\n\t}\n\n\treturn nil, errors.New(\"one of --file, --token-file, --token-stdin or --token must be provided\")\n}\n\nfunc (c *storageFromConfigFlags) connectToStorageFromConfigFile(ctx context.Context) (blob.Storage, error) {\n\tcfg, err := repo.LoadConfigFromFile(c.connectFromConfigFile)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to open config\")\n\t}\n\n\tif cfg.Storage == nil {\n\t\treturn nil, errors.New(\"connection file does not specify blob storage connection parameters, kopia server connections are not supported\")\n\t}\n\n\t//nolint:wrapcheck\n\treturn blob.NewStorage(ctx, *cfg.Storage, false)\n}\n\nfunc (c *storageFromConfigFlags) connectToStorageFromConfigToken(ctx context.Context, token string) (blob.Storage, error) {\n\tci, pass, err := repo.DecodeToken(token)","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/cli/command_repository_connect_from_config.go#L38-L74","documentation":"The non-create path of `repository connect from-config` requires some way to locate the repository: either a connection file via --file or credentials via --token-file/--token-stdin/--token. Connect raised this fallback error because no such input was provided.","triggerScenarios":"Running `kopia repository connect from-config` (without --create) with none of --file, --token-file, --token-stdin, or --token set; raised at cli/command_repository_connect_from_config.go:56.","commonSituations":"Users assuming the --config-file flag alone is enough to reconnect; automation scripts that dropped the token arguments; typos in flag names causing kopia to see them as unset.","solutions":["Add --token-file <path> (most common) with the token issued when the repository was created.","Or supply the connection via --file <connect.config>, --token-stdin, or --token.","Verify flag spelling; a mis-typed flag is silently ignored and triggers this error."],"exampleFix":"// before\nkopia repository connect from-config myrepo.config\n// after\nkopia repository connect from-config myrepo.config --token-file kopia.token","handlingStrategy":"validation","validationCode":"flags := []bool{hasFile, hasTokenFile, hasTokenStdin, hasToken}\nif !slices.ContainsFunc(flags, func(v bool) bool { return v }) {\n  return errors.New(\"one of --file, --token-file, --token-stdin or --token is required\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use `kopia repository connect from-config --help` to confirm required flags before scripting.","Check for flag typos — silently ignored flags cause this error."],"tags":["cli","missing-flag","repository-connect"],"backgroundTag":"missing-required-flag","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"}