trailofbits/algo · error
Error while restarting server that was stopped [{response.st
Error message
Error while restarting server that was stopped [{response.status_code}: {response.json}]. What it means
Raised when restarting a server that was in 'stopped' state: the module calls the action endpoint (effectively 'power on') and the API returns a non-2xx response. Status code and JSON error body are embedded in the message.
Source
Thrown at library/scaleway_compute.py:522
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,
}
def find(compute_api, wished_server, per_page=1):
compute_api.module.debug("Getting inside find")
# Only the name attribute is accepted in the Compute query API
response = compute_api.get("servers", params={"name": wished_server["name"], "per_page": per_page})View on GitHub (pinned to 20e22a8715)
Solutions
- Inspect the embedded status code and response.json for the exact cause
- Ensure the instance exists and is not being deleted
- Retry the play after a short wait; Scaleway state transitions are async
Defensive patterns
Strategy: retry
Try / catch
- name: Restart stopped server
scaleway_compute:
state: restarted
register: r
retries: 3
delay: 15
until: not r.failed Prevention
- Ensure the instance is fully provisioned before restart tasks
- Keep tokens scoped and valid for compute actions
When it happens
Trigger: restart_strategy finds fetch_state(...) == 'stopped' and calls restart_server(); the Scaleway API rejects the action (401/403/404 or server in an unstable state).
Common situations: Powering on an instance that is mid-deletion, token lacking compute permissions, or API transient failure.
Related errors
- Error while stopping server [{response.status_code}: {respon
- Error while restarting server that was running [{response.st
- Error during server search: (%s) %s
- Error during server attributes patching: (%s) %s
- Error while checking if attributes should be changed
AI-assisted analysis of trailofbits/algo@20e22a8715 (2026-08-28).
Data as JSON: /api/errors/0d469082566de007.
Report an issue: GitHub.