Skip to content

Commit 7725d22

Browse files
Merge pull request #78 from Infisical/fix/error-message
fix: CLI error message
2 parents b59dbc5 + e4a0efd commit 7725d22

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/api/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func NewAPIErrorWithResponse(operation string, res *resty.Response, additionalCo
110110
if apiError.AdditionalContext == "" {
111111
domainHint := extractDomainHint(res.Request.URL)
112112
if domainHint != "" {
113-
apiError.AdditionalContext = fmt.Sprintf("This error often indicates you're using the wrong Infisical instance. Current request is to: %s\n\nTo fix this:\n• Verify you're using the correct domain with --domain flag or INFISICAL_API_URL environment variable\n• For EU region: use --domain https://eu.infisical.com\n• For self-hosted instances: use --domain https://your-instance.com", domainHint)
113+
apiError.AdditionalContext = fmt.Sprintf("Check your credentials or verify you're using the correct domain. Current domain: %s", domainHint)
114114
}
115115
}
116116
}

packages/cmd/login.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ var loginCmd = &cobra.Command{
277277
errMsg := err.Error()
278278

279279
if strings.Contains(errMsg, "status-code=401") || strings.Contains(errMsg, "status-code=403") {
280-
domainHint = fmt.Sprintf("\n\nThis error often indicates you're using the wrong Infisical instance. Current request is to: %s\n\nTo fix this:\n• Verify you're using the correct domain with --domain flag or INFISICAL_API_URL environment variable\n• For EU region: use --domain https://eu.infisical.com\n• For self-hosted instances: use --domain https://your-instance.com", currentDomain)
280+
domainHint = fmt.Sprintf("\n\nCheck your credentials or verify you're using the correct domain. Current domain: %s", currentDomain)
281281
}
282282

283283
util.HandleError(fmt.Errorf("unable to authenticate with %s [err=%v].%s", formatAuthMethod(loginMethod), err, domainHint))

0 commit comments

Comments
 (0)