{"record":{"id":"dde91e3682dd3167","repo":"trailofbits/algo","slug":"error-during-server-attributes-patching-s-s","errorCode":null,"errorMessage":"Error during server attributes patching: (%s) %s","messagePattern":"Error during server attributes patching: \\((.+?)\\) (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"library/scaleway_compute.py","lineNumber":607,"sourceCode":"def server_change_attributes(compute_api, target_server, wished_server):\n    compute_api.module.debug(\"Starting patching server attributes\")\n    patch_payload = dict()\n\n    for key in PATCH_MUTABLE_SERVER_ATTRIBUTES:\n        if key in target_server and key in wished_server:\n            # When you are working with dict, only ID matter as we ask user to put only the resource ID in the playbook\n            if isinstance(target_server[key], dict) and \"id\" in target_server[key] and wished_server[key]:\n                # Setting all key to current value except ID\n                key_dict = dict((x, target_server[key][x]) for x in target_server[key].keys() if x != \"id\")\n                # Setting ID to the user specified ID\n                key_dict[\"id\"] = wished_server[key]\n                patch_payload[key] = key_dict\n            elif not isinstance(target_server[key], dict):\n                patch_payload[key] = wished_server[key]\n\n    response = compute_api.patch(path=\"servers/%s\" % target_server[\"id\"], data=patch_payload)\n    if not response.ok:\n        msg = \"Error during server attributes patching: (%s) %s\" % (response.status_code, response.json)\n        compute_api.module.fail_json(msg=msg)\n\n    try:\n        target_server = response.json[\"server\"]\n    except KeyError:\n        compute_api.module.fail_json(msg=\"Error in getting the server information from: %s\" % response.json)\n\n    wait_to_complete_state_transition(compute_api=compute_api, server=target_server)\n\n    return target_server\n\n\ndef core(module):\n    region = module.params[\"region\"]\n    wished_server = {\n        \"state\": module.params[\"state\"],\n        \"image\": module.params[\"image\"],\n        \"name\": module.params[\"name\"],","sourceCodeStart":589,"sourceCodeEnd":625,"githubUrl":"https://github.com/trailofbits/algo/blob/20e22a8715c198b38c01c1ca62d0953b93587a74/library/scaleway_compute.py#L589-L625","documentation":"Raised when the PATCH /servers/{id} request that applies attribute changes (name, tags, cloud-init, etc.) returns a non-2xx response. The Scaleway API status code and JSON body are included in the message text.","triggerScenarios":"server_change_attributes issues compute_api.patch('servers/%s' % id, data=patch_payload) and response.ok is false — e.g. 400 invalid patch payload, 401 bad token, 404 server deleted, or immutable field modification.","commonSituations":"Trying to patch read-only attributes, sending tags in the wrong format, stale server id, or token without write permission.","solutions":["Read the embedded status/JSON to see which field the API rejected","Validate wished_server attributes against the Scaleway API docs (only name, tags, and a few fields are patchable)","Confirm the server id is current and the token has write scope","Retry after the server exits any in-progress task"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"- name: Patch attributes\n  scaleway_compute: ...\n  register: p\n  retries: 2\n  delay: 10\n  until: not p.failed","preventionTips":["Only patch mutable fields (name, tags)","Check API error body for field-level validation messages"],"tags":["scaleway","api-error","ansible","patch"],"backgroundTag":"cloud-api-request-failed","analyzedSha":"20e22a8715c198b38c01c1ca62d0953b93587a74","analyzedAt":"2026-08-28T13:26:02.752Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}