{"record":{"id":"b4e170d76127ac25","repo":"getsops/sops","slug":"cannot-create-vault-client-w","errorCode":null,"errorMessage":"cannot create Vault client: %w","messagePattern":"cannot create Vault client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hcvault/keysource.go","lineNumber":415,"sourceCode":"func vaultClient(address, token string, hc *http.Client) (*api.Client, error) {\n\tcfg := api.DefaultConfig()\n\tcfg.Address = address\n\n\tallowlist, err := getAllowlist()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !allowlist.Allows(address) {\n\t\treturn nil, fmt.Errorf(\"Allowlist does not allow %s\", address)\n\t}\n\n\tif hc != nil {\n\t\tcfg.HttpClient = hc\n\t}\n\n\tclient, err := api.NewClient(cfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot create Vault client: %w\", err)\n\t}\n\n\tif token != \"\" {\n\t\tclient.SetToken(token)\n\t}\n\t// Provided token takes precedence over the user's token.\n\tif client.Token() == \"\" {\n\t\tif token, err = userVaultToken(); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot get Vault token: %w\", err)\n\t\t}\n\t\tif token != \"\" {\n\t\t\tclient.SetToken(token)\n\t\t}\n\t}\n\n\treturn client, nil\n}\n","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/getsops/sops/blob/13442bb98183887d7a9ac09ec8ab0564673a59d8/hcvault/keysource.go#L397-L433","documentation":"Error \"cannot create Vault client: %w\" thrown in getsops/sops.","triggerScenarios":"Thrown at hcvault/keysource.go:415 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"13442bb98183887d7a9ac09ec8ab0564673a59d8","analyzedAt":"2026-09-01T03:53:00.447Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}