{"record":{"id":"e1944e7f03e7545a","repo":"kubernetes/kops","slug":"spotinst-failed-to-update-ocean-v","errorCode":null,"errorMessage":"spotinst: failed to update ocean: %v","messagePattern":"spotinst: failed to update ocean: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/spotinsttasks/ocean.go","lineNumber":1141,"sourceCode":"\t\tklog.Warningf(\"Not all changes applied to Ocean %q: %v\", *e.Name, changes)\n\t}\n\n\tif !changed {\n\t\tklog.V(2).Infof(\"No changes detected in Ocean %q\", *e.Name)\n\t\treturn nil\n\t}\n\n\tklog.V(2).Infof(\"Updating Ocean %q (config: %s)\", *e.Name, stringutil.Stringify(ocean))\n\n\t// Wrap the raw object as an Ocean.\n\toc, err := spotinst.NewOcean(cloud.ProviderID(), ocean)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Update an existing Ocean.\n\tif err := cloud.Spotinst().Ocean().Update(context.Background(), oc); err != nil {\n\t\treturn fmt.Errorf(\"spotinst: failed to update ocean: %v\", err)\n\t}\n\n\treturn nil\n}\n\ntype terraformOcean struct {\n\tName                   *string                    `cty:\"name\"`\n\tControllerClusterID    *string                    `cty:\"controller_id\"`\n\tRegion                 *string                    `cty:\"region\"`\n\tInstanceTypesWhitelist []string                   `cty:\"whitelist\"`\n\tInstanceTypesBlacklist []string                   `cty:\"blacklist\"`\n\tSubnetIDs              []*terraformWriter.Literal `cty:\"subnet_ids\"`\n\tAutoScaler             *terraformAutoScaler       `cty:\"autoscaler\"`\n\tTags                   []*terraformKV             `cty:\"tags\"`\n\n\tMinSize         *int64 `cty:\"min_size\"`\n\tMaxSize         *int64 `cty:\"max_size\"`\n\tDesiredCapacity *int64 `cty:\"desired_capacity\"`","sourceCodeStart":1123,"sourceCodeEnd":1159,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/spotinsttasks/ocean.go#L1123-L1159","documentation":"kOps failed while pushing an updated Ocean cluster spec to the Spotinst API during `kops update cluster`. The Ocean already exists, so the `Ocean().Update` call returned an error and it is wrapped verbatim; the root cause is in the inner message (validation rejection, concurrent modification, auth, API outage).","triggerScenarios":"Running `kops update cluster` against an existing Spotinst Ocean when the generated Ocean spec change is rejected: incompatible field change (e.g. region/VPC immutable), Spotinst API 4xx/5xx, expired token, or the Ocean was deleted out-of-band so the update target no longer exists.","commonSituations":"Changing node instance types, min/max size, or launch specification on a live cluster; stale Spotinst credentials after token rotation; Ocean deleted in the Spotinst console while kOps still tracks it.","solutions":["Inspect the wrapped `%v` message for the concrete Spotinst API error code and address that first.","Confirm the Ocean still exists in the Spotinst console; if it was deleted out-of-band, recreate it or remove/recreate the kOps-managed resource.","Avoid immutable field changes (VPC, region) on an existing Ocean — create a new Ocean/cluster instead.","Verify Spotinst credentials and re-run `kops update cluster` if the API was temporarily unavailable."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// preflight: confirm the Ocean still exists before updating\nif _, err := spotinstClient.Ocean().Get(ctx, oceanID); err != nil {\n    return fmt.Errorf(\"ocean %s missing; recreate before update: %w\", oceanID, err)\n}","typeGuard":null,"tryCatchPattern":"err := runKopsUpdate(ctx)\nif err != nil && strings.Contains(err.Error(), \"failed to update ocean\") {\n    log.Printf(\"spotinst update rejected: %v\", err) // inner message has the API reason\n    return err\n}","preventionTips":["Do not change immutable Ocean fields (region, VPC) on an existing cluster.","Keep Spotinst tokens rotated in sync with kOps configuration.","Diff `kops update cluster` output before applying to catch rejected spec changes early."],"tags":["spotinst","aws","cluster-update","api-error"],"backgroundTag":"spotinst-ocean-update-failed","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"}