trailofbits/algo · error

Error during server attributes patching: (%s) %s

Error message

Error during server attributes patching: (%s) %s

What it means

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.

Source

Thrown at library/scaleway_compute.py:607

def server_change_attributes(compute_api, target_server, wished_server):
    compute_api.module.debug("Starting patching server attributes")
    patch_payload = dict()

    for key in PATCH_MUTABLE_SERVER_ATTRIBUTES:
        if key in target_server and key in wished_server:
            # When you are working with dict, only ID matter as we ask user to put only the resource ID in the playbook
            if isinstance(target_server[key], dict) and "id" in target_server[key] and wished_server[key]:
                # Setting all key to current value except ID
                key_dict = dict((x, target_server[key][x]) for x in target_server[key].keys() if x != "id")
                # Setting ID to the user specified ID
                key_dict["id"] = wished_server[key]
                patch_payload[key] = key_dict
            elif not isinstance(target_server[key], dict):
                patch_payload[key] = wished_server[key]

    response = compute_api.patch(path="servers/%s" % target_server["id"], data=patch_payload)
    if not response.ok:
        msg = "Error during server attributes patching: (%s) %s" % (response.status_code, response.json)
        compute_api.module.fail_json(msg=msg)

    try:
        target_server = response.json["server"]
    except KeyError:
        compute_api.module.fail_json(msg="Error in getting the server information from: %s" % response.json)

    wait_to_complete_state_transition(compute_api=compute_api, server=target_server)

    return target_server


def core(module):
    region = module.params["region"]
    wished_server = {
        "state": module.params["state"],
        "image": module.params["image"],
        "name": module.params["name"],

View on GitHub (pinned to 20e22a8715)

Solutions

  1. Read the embedded status/JSON to see which field the API rejected
  2. Validate wished_server attributes against the Scaleway API docs (only name, tags, and a few fields are patchable)
  3. Confirm the server id is current and the token has write scope
  4. Retry after the server exits any in-progress task
Defensive patterns

Strategy: retry

Try / catch

- name: Patch attributes
  scaleway_compute: ...
  register: p
  retries: 2
  delay: 10
  until: not p.failed

Prevention

When it happens

Trigger: 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.

Common situations: Trying to patch read-only attributes, sending tags in the wrong format, stale server id, or token without write permission.

Related errors


AI-assisted analysis of trailofbits/algo@20e22a8715 (2026-08-28). Data as JSON: /api/errors/dde91e3682dd3167. Report an issue: GitHub.