{"record":{"id":"c2f8f06eb437d1cf","repo":"kubernetes/kops","slug":"spotinst-failed-to-find-launch-spec-q-v","errorCode":null,"errorMessage":"spotinst: failed to find launch spec %q: %v","messagePattern":"spotinst: failed to find launch spec %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/spotinsttasks/launch_spec.go","lineNumber":109,"sourceCode":"\t}\n\n\tif o.Ocean != nil {\n\t\tdeps = append(deps, o.Ocean)\n\t}\n\n\tif o.UserData != nil {\n\t\tdeps = append(deps, fi.FindDependencies(tasks, o.UserData)...)\n\t}\n\n\treturn deps\n}\n\nfunc (o *LaunchSpec) find(svc spotinst.LaunchSpecService, oceanID string) (*aws.LaunchSpec, error) {\n\tklog.V(4).Infof(\"Attempting to find LaunchSpec: %q\", fi.ValueOf(o.Name))\n\n\tspecs, err := svc.List(context.Background(), oceanID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"spotinst: failed to find launch spec %q: %v\", fi.ValueOf(o.Name), err)\n\t}\n\tif len(specs) == 0 {\n\t\treturn nil, fmt.Errorf(\"spotinst: no launch specs associated with ocean %q\", oceanID)\n\t}\n\n\tvar out *aws.LaunchSpec\n\tfor _, spec := range specs {\n\t\tif spec.Name() == fi.ValueOf(o.Name) {\n\t\t\tout = spec.Obj().(*aws.LaunchSpec)\n\t\t\tbreak\n\t\t}\n\t}\n\tif out == nil {\n\t\treturn nil, fmt.Errorf(\"spotinst: failed to find launch spec %q\", fi.ValueOf(o.Name))\n\t}\n\n\tklog.V(4).Infof(\"LaunchSpec/%s: %s\", fi.ValueOf(o.Name), stringutil.Stringify(out))\n\treturn out, nil","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/spotinsttasks/launch_spec.go#L91-L127","documentation":"LaunchSpec.find lists all launch specs under a Spotinst Ocean to locate the one managed by this kops task. If the Spotinst API List call itself fails, the underlying error is wrapped and rethrown. This is a Spotinst API communication failure, not a missing resource.","triggerScenarios":"During Find or update of a LaunchSpec task, svc.List(ctx, oceanID) returns an error (API auth failure, network error, invalid ocean ID, rate limiting).","commonSituations":"Expired or invalid Spotinst API token; Spotinst API outage; network/proxy issues from CI runner; ocean ID stale after cluster was deleted.","solutions":["Check SPOTINST_TOKEN / SPOTINST_ACCOUNT environment variables are valid","Verify network connectivity to the Spotinst API endpoint","Confirm the Ocean still exists in the Spotinst console","Retry after rate-limit/throttle backoff"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if os.Getenv(\"SPOTINST_TOKEN\") == \"\" || os.Getenv(\"SPOTINST_ACCOUNT\") == \"\" {\n    return errors.New(\"SPOTINST_TOKEN and SPOTINST_ACCOUNT must be set\")\n}","typeGuard":null,"tryCatchPattern":"specs, err := svc.List(ctx, oceanID)\nif err != nil {\n    // retry with backoff for transient API/network errors\n    if attempt < maxRetries {\n        time.Sleep(backoff)\n        continue\n    }\n    return fmt.Errorf(\"spotinst list launch specs failed after retries: %w\", err)\n}","preventionTips":["Rotate Spotinst API tokens before expiry","Monitor Spotinst API status during CI runs","Add backoff/retry around Spotinst API calls","Confirm Ocean IDs against the console before automation runs"],"tags":["spotinst","api-error","launch-spec"],"backgroundTag":"spotinst-api-error","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}