{"record":{"id":"26e6f8951059bb72","repo":"hashicorp/nomad","slug":"volume-q-already-exists-but-is-incompatible-with","errorCode":null,"errorMessage":"volume %q already exists but is incompatible with these parameters: %v","messagePattern":"volume %q already exists but is incompatible with these parameters: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/csi/client.go","lineNumber":447,"sourceCode":"\tcreq := req.ToCSIRepresentation()\n\tresp, err := c.controllerClient.CreateVolume(ctx, creq, opts...)\n\n\t// these standard gRPC error codes are overloaded with CSI-specific\n\t// meanings, so translate them into user-understandable terms\n\t// https://github.com/container-storage-interface/spec/blob/master/spec.md#createvolume-errors\n\tif err != nil {\n\t\tcode := status.Code(err)\n\t\tswitch code {\n\t\tcase codes.InvalidArgument:\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"volume %q snapshot source %q is not compatible with these parameters: %v\",\n\t\t\t\treq.Name, req.ContentSource, err)\n\t\tcase codes.NotFound:\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"volume %q content source %q does not exist: %v\",\n\t\t\t\treq.Name, req.ContentSource, err)\n\t\tcase codes.AlreadyExists:\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"volume %q already exists but is incompatible with these parameters: %v\",\n\t\t\t\treq.Name, err)\n\t\tcase codes.ResourceExhausted:\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"unable to provision %q in accessible_topology: %v\",\n\t\t\t\treq.Name, err)\n\t\tcase codes.OutOfRange:\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"unsupported capacity_range for volume %q: %v\", req.Name, err)\n\t\tcase codes.Internal:\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"controller plugin returned an internal error, check the plugin allocation logs for more information: %v\", err)\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn NewCreateVolumeResponse(resp), nil\n}","sourceCodeStart":429,"sourceCodeEnd":465,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/plugins/csi/client.go#L429-L465","documentation":"ControllerCreateVolume got gRPC code AlreadyExists from the CSI plugin: a volume with the requested name/ID is already present but its existing properties don't match the requested parameters. Nomad surfaces this so the operator knows reuse was refused rather than silently proceeding with an incompatible existing volume.","triggerScenarios":"Calling ControllerCreateVolume where the backend already has a volume with req.Name (or the derived external ID) but with different capacity, capabilities, or topology than requested, causing the plugin to return codes.AlreadyExists.","commonSituations":"Re-registering a volume in Nomad after the backend volume was created with different parameters; stale volume from a previous job; cluster migration where the same external volume ID exists with a different size.","solutions":["Check the existing volume's parameters in the backend and update the Nomad volume spec to match them.","Delete the conflicting backend volume if it is unused, then retry creation.","Use a different volume name/ID if you genuinely want a new, distinct volume.","Run `nomad volume status` and `nomad volume deregister` to clear stale registrations before recreating."],"exampleFix":"// before (spec asks 20GiB, backend volume is 10GiB)\nsize = 20\n// after (match existing volume)\nsize = 10","handlingStrategy":"validation","validationCode":"// Check for an existing conflicting volume before creating\nexisting, _ := findBackendVolumeByName(req.Name)\nif existing != nil && !paramsMatch(existing, requestedParams) {\n    return fmt.Errorf(\"volume %s exists with different params; reconcile spec or rename\", req.Name)\n}","typeGuard":"func canReuseVolume(existing *csi.Volume, req *csi.CreateVolumeRequest) bool {\n    return existing != nil && existing.CapacityBytes >= req.CapacityRange.RequiredBytes\n}","tryCatchPattern":"vol, err := client.ControllerCreateVolume(ctx, req)\nif err != nil && strings.Contains(err.Error(), \"already exists but is incompatible\") {\n    // adopt matching params or delete/rename the existing volume, then retry\n}","preventionTips":["Deregister stale volumes (`nomad volume deregister`) before recreating with new parameters.","Keep volume specs in version control so parameters stay consistent across recreations.","Use unique volume names per environment to avoid collisions."],"tags":["csi","grpc","storage","conflict"],"backgroundTag":"resource-already-exists","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}