ory/kratos · error
you have to set the remote endpoint, try --help for details
Error message
you have to set the remote endpoint, try --help for details
What it means
NewClient found no remote endpoint: neither the --endpoint flag nor the endpoint environment variable (envKeyEndpoint) is set, and the client context did not already carry an API client. The CLI cannot reach any Ory Kratos server without one.
Solutions
- Pass the --endpoint flag (e.g. --endpoint https://kratos.example.com) on the command being run
- Export the endpoint environment variable that NewClient falls back to (envKeyEndpoint)
- Verify the flag name with --help if unsure
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cmd/cliclient/client.go:64 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ory/kratos@b86338da04 (2026-09-07).
Data as JSON: /api/errors/e6c8f0be9323c27e.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/cliclient/client.go:64
conf := kratos.NewConfiguration()
conf.HTTPClient = cc.HTTPClient
conf.Servers = kratos.ServerConfigurations{{URL: cc.Endpoint}}
return kratos.NewAPIClient(conf), nil
} else if f != nil {
return nil, errors.Errorf("ClientContextKey was expected to be *client.OryKratos but it contained an invalid type %T ", f)
}
endpoint, err := cmd.Flags().GetString(FlagEndpoint)
if err != nil {
return nil, errors.WithStack(err)
}
if endpoint == "" {
endpoint = os.Getenv(envKeyEndpoint)
}
if endpoint == "" {
return nil, errors.Errorf("you have to set the remote endpoint, try --help for details")
}
u, err := url.Parse(endpoint)
if err != nil {
return nil, errors.Wrapf(err, `could not parse the endpoint URL "%s"`, endpoint)
}
conf := kratos.NewConfiguration()
conf.HTTPClient = httpx.NewResilientClient(
httpx.ResilientClientWithConnectionTimeout(10 * time.Second),
).StandardClient()
conf.Servers = kratos.ServerConfigurations{{URL: u.String()}}
return kratos.NewAPIClient(conf), nil
}
func RegisterClientFlags(flags *pflag.FlagSet) {
flags.StringP(FlagEndpoint, FlagEndpoint[:1], "", fmt.Sprintf("The URL of Ory Kratos' Admin API. Alternatively set using the %s environmental variable.", envKeyEndpoint))
}View on GitHub (pinned to b86338da04)