{"record":{"id":"2139f2eede10f89b","repo":"charmbracelet/crush","slug":"failed-to-fetch-provider-from-hyper-w","errorCode":null,"errorMessage":"failed to fetch provider from Hyper: %w","messagePattern":"failed to fetch provider from Hyper: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/config/provider.go","lineNumber":129,"sourceCode":"type HyperTokenRefresher func(context.Context) error\n\n// UpdateHyper updates the Hyper provider information from a specified URL.\nfunc UpdateHyper(pathOrURL string) error {\n\tvar provider catwalk.Provider\n\tpathOrURL = cmp.Or(pathOrURL, hyper.BaseURL())\n\n\tswitch {\n\tcase pathOrURL == \"embedded\":\n\t\tprovider = hyper.Embedded()\n\tcase strings.HasPrefix(pathOrURL, \"http://\") || strings.HasPrefix(pathOrURL, \"https://\"):\n\t\tclient := realHyperClient{\n\t\t\tbaseURL:    pathOrURL,\n\t\t\tresolveKey: func() string { return resolveHyperAPIKey(nil) },\n\t\t}\n\t\tvar err error\n\t\tprovider, err = client.Get(context.Background(), \"\")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to fetch provider from Hyper: %w\", err)\n\t\t}\n\tdefault:\n\t\tcontent, err := os.ReadFile(pathOrURL)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to read file: %w\", err)\n\t\t}\n\t\tif err := json.Unmarshal(content, &provider); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to unmarshal provider data: %w\", err)\n\t\t}\n\t}\n\n\tif err := newCache[catwalk.Provider](cachePathFor(\"hyper\")).Store(provider); err != nil {\n\t\treturn fmt.Errorf(\"failed to save Hyper provider to cache: %w\", err)\n\t}\n\n\tslog.Info(\"Hyper provider updated successfully\", \"from\", pathOrURL, \"to\", cachePathFor(\"hyper\"))\n\treturn nil\n}","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/charmbracelet/crush/blob/7944b8e52225d8805e31eacbf7ef24856b0dfb7a/internal/config/provider.go#L111-L147","documentation":"UpdateHyper fetches the Hyper provider definition either from a URL via the Hyper client's Get method or from a local JSON file. This error wraps a failure of client.Get against the Hyper endpoint at pathOrURL: network failure, non-2xx response, or invalid response payload. Without it, the Hyper provider cannot be registered.","triggerScenarios":"Calling config.UpdateHyper with an http(s) pathOrURL when the Hyper endpoint is unreachable, returns an error status, requires an API key that resolveHyperAPIKey cannot find, or the context is cancelled.","commonSituations":"Wrong Hyper base URL in config; missing HYPER_API_KEY-style env var; Hyper service outage; corporate proxy blocking the request.","solutions":["Verify the base URL and that the service is up (`curl -v <baseURL>`).","Export the API key env var expected by resolveHyperAPIKey.","Check proxy settings (HTTPS_PROXY) and DNS resolution.","Fall back to supplying the provider as a local JSON file path instead of a URL."],"exampleFix":"// before\nerr := config.UpdateHyper(\"http://hyper.internal:8080\")\n// after\nos.Setenv(\"HYPER_API_KEY\", key) // ensure key resolves\nerr := config.UpdateHyper(\"https://hyper.internal:8080\")","handlingStrategy":"try-catch","validationCode":"resp, err := http.Get(baseURL + \"/health\")\nif err != nil || resp.StatusCode != http.StatusOK {\n    return fmt.Errorf(\"hyper endpoint unreachable before UpdateHyper: %v\", err)\n}\nif os.Getenv(\"HYPER_API_KEY\") == \"\" {\n    return errors.New(\"HYPER_API_KEY not set; UpdateHyper will fail auth\")\n}","typeGuard":null,"tryCatchPattern":"provider, err := client.Get(ctx, \"\")\nif err != nil {\n    var netErr net.Error\n    if errors.As(err, &netErr) || errors.Is(err, context.DeadlineExceeded) {\n        slog.Warn(\"hyper fetch failed; will retry with backoff\", \"err\", err)\n    }\n    return fmt.Errorf(\"failed to fetch provider from Hyper: %w\", err)\n}","preventionTips":["Health-check the Hyper base URL before configuring it.","Export the API key env var resolveHyperAPIKey expects before startup.","Add retries with backoff for transient network failures.","Keep a local JSON fallback file for offline environments."],"tags":["network","http","hyper","providers"],"backgroundTag":"http-request-failed","analyzedSha":"7944b8e52225d8805e31eacbf7ef24856b0dfb7a","analyzedAt":"2026-08-29T12:48:59.079Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}