{"record":{"id":"295ed5ed657b9baf","repo":"ory/hydra","slug":"you-have-to-set-the-remote-endpoint-try-help-fo","errorCode":null,"errorMessage":"you have to set the remote endpoint, try --help for details","messagePattern":"you have to set the remote endpoint, try --help for details","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"oryx/cmdx/http.go","lineNumber":75,"sourceCode":"\t\treturn nil, err\n\t}\n\n\treturn endpoint, nil\n}\n\n// NewClient creates a new HTTP client.\nfunc NewClient(cmd *cobra.Command) (*http.Client, *url.URL, error) {\n\tendpoint, err := cmd.Flags().GetString(FlagEndpoint)\n\tif err != nil {\n\t\treturn nil, nil, errors.WithStack(err)\n\t}\n\n\tif endpoint == \"\" {\n\t\tendpoint = os.Getenv(envKeyEndpoint)\n\t}\n\n\tif endpoint == \"\" {\n\t\treturn nil, nil, errors.Errorf(\"you have to set the remote endpoint, try --help for details\")\n\t}\n\n\tu, err := url.Parse(strings.TrimRight(endpoint, \"/\"))\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrapf(err, `could not parse the endpoint URL \"%s\"`, endpoint)\n\t}\n\n\thc := retryablehttp.NewClient().StandardClient()\n\thc.Timeout = time.Second * 10\n\n\trawHeaders, err := cmd.Flags().GetStringSlice(FlagHeaders)\n\tif err != nil {\n\t\treturn nil, nil, errors.WithStack(err)\n\t}\n\theader := http.Header{}\n\tfor _, h := range rawHeaders {\n\t\tparts := strings.Split(h, \":\")\n\t\tif len(parts) != 2 {","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/ory/hydra/blob/4174065ffb052799890f7480f5360a877a67ffc1/oryx/cmdx/http.go#L57-L93","documentation":"cmdx.NewClient builds an HTTP client for a CLI command targeting a remote endpoint. The endpoint must come from a flag or the environment variable (envKeyEndpoint); when both are empty it refuses to proceed with this message, pointing the user to --help.","triggerScenarios":"Running a CLI subcommand that requires a remote API without passing the endpoint flag and without the corresponding environment variable set (e.g. HYDRA_CLI_URL/ORY_URL style env var unset), so endpoint remains \"\" after both lookups.","commonSituations":"CI environments where the endpoint env var was never exported; forgetting the --endpoint flag while the env var has a different name than expected; typos in the env var name.","solutions":["Pass the remote endpoint explicitly via the command's endpoint flag","Export the expected environment variable (see envKeyEndpoint in oryx/cmdx/http.go) with the remote URL","Run the command with --help to see the exact flag/env names","Fix CI/shell scripts so the env var is set before invoking the command"],"exampleFix":"// before\n$ hydra token client --client-id foo\n// after\n$ export HYDRA_CLI_URL=https://hydra.example.com\n$ hydra token client --client-id foo","handlingStrategy":"validation","validationCode":"endpoint := flagOrEnvEndpoint()\nif endpoint == \"\" {\n    return fmt.Errorf(\"remote endpoint missing: set the endpoint flag or %s\", envKeyEndpoint)\n}","typeGuard":null,"tryCatchPattern":"client, err := cmdx.NewClient(cmd)\nif err != nil && strings.Contains(err.Error(), \"you have to set the remote endpoint\") {\n    return cmd.Usage() // guide user to the flag/env var\n}","preventionTips":["Always export the endpoint env var in shell profiles and CI before running CLI commands","Verify the exact env var name with --help; do not guess","Add preflight checks in scripts that assert the env var is non-empty","Prefer explicit flags in scripts to avoid env-var ambiguity"],"tags":["cli","configuration","endpoint","missing-env-var"],"backgroundTag":"missing-endpoint-config","analyzedSha":"4174065ffb052799890f7480f5360a877a67ffc1","analyzedAt":"2026-09-03T14:52:41.581Z","contentChangedAt":"2026-09-03T14:52:41.581Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}