trailofbits/algo · error

Error while restarting server that was running [{response.st

Error message

Error while restarting server that was running [{response.status_code}: {response.json}].

What it means

Raised when restarting a Scaleway server that is currently 'running': the module issues an API 'reboot' action and the response is not ok. The status code and JSON body of the failed reboot call are included in the message.

Source

Thrown at library/scaleway_compute.py:515

            return changed, {
                "status": "Server %s attributes would be changed before rebooting it." % target_server["id"]
            }

        target_server = server_change_attributes(
            compute_api=compute_api, target_server=target_server, wished_server=wished_server
        )

    changed = True
    if compute_api.module.check_mode:
        return changed, {"status": "Server %s would be rebooted." % target_server["id"]}

    wait_to_complete_state_transition(compute_api=compute_api, server=target_server)

    if fetch_state(compute_api=compute_api, server=target_server) in ("running",):
        response = restart_server(compute_api=compute_api, server=target_server)
        wait_to_complete_state_transition(compute_api=compute_api, server=target_server)
        if not response.ok:
            msg = f"Error while restarting server that was running [{response.status_code}: {response.json}]."
            compute_api.module.fail_json(msg=msg)

    if fetch_state(compute_api=compute_api, server=target_server) in ("stopped",):
        response = restart_server(compute_api=compute_api, server=target_server)
        wait_to_complete_state_transition(compute_api=compute_api, server=target_server)
        if not response.ok:
            msg = f"Error while restarting server that was stopped [{response.status_code}: {response.json}]."
            compute_api.module.fail_json(msg=msg)

    return changed, target_server


state_strategy = {
    "present": present_strategy,
    "restarted": restart_strategy,
    "stopped": stop_strategy,
    "running": running_strategy,
    "absent": absent_strategy,

View on GitHub (pinned to 20e22a8715)

Solutions

  1. Read the status code/JSON in the message to identify the API reason
  2. Retry after waiting for the server's current task to finish (state transitions are asynchronous)
  3. Verify token permissions and that the instance still exists in the Scaleway console
Defensive patterns

Strategy: retry

Try / catch

- name: Restart
  scaleway_compute:
    state: restarted
  register: r
  retries: 3
  delay: 15
  until: not r.failed

Prevention

When it happens

Trigger: restart_strategy detects fetch_state(...) == 'running' and calls restart_server(); the Scaleway reboot endpoint returns 4xx/5xx (bad token, server locked in a task, 404).

Common situations: Rebooting an instance that has a pending blocking task, insufficient permissions on the token, or an instance that was deleted between the state check and the reboot call.

Related errors


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