spinnaker/spinnaker · error
encountered an error canceling execution with id
Error message
encountered an error canceling execution with id %s, status code: %d
What it means
After CancelPipeline returns successfully at the transport level, the CLI expects HTTP 200 OK. Any other status produces this error naming the execution id and status code. It indicates the cancel request was rejected or failed server-side and the execution may still be running.
Solutions
- Confirm the execution is still running: `spin pipeline execution get <id>`
- If 404, the id is wrong or the execution record was deleted; fetch a fresh id via `spin pipeline execution list --pipeline-id <id>`
- If 403, request cancel permission on the application in Fiat/RBAC
- Check Gate logs for the cancel request's error detail
Example fix
// before: assumes cancel always works spin pipeline execution cancel "$ID" // after: verify the execution is still running first STATUS=$(spin pipeline execution get "$ID" | jq -r '.status') case "$STATUS" in RUNNING|NOT_STARTED|PAUSED) spin pipeline execution cancel "$ID" ;; *) echo "execution $ID is $STATUS; nothing to cancel" ;; esac
Defensive patterns
Strategy: try-catch
Validate before calling
// Verify the execution is still cancelable first
spin pipeline execution get "$ID" | jq -e '.status | test("RUNNING|NOT_STARTED|PAUSED")' || { echo "not cancelable"; exit 1; } Type guard
func isCancelable(status string) bool {
switch status { case "RUNNING", "NOT_STARTED", "PAUSED": return true }
return false
} Try / catch
if resp.StatusCode != http.StatusOK {
if resp.StatusCode == http.StatusNotFound {
return fmt.Errorf("execution %s not found (already finished or purged)", id)
}
return fmt.Errorf("cancel failed with status %d", resp.StatusCode)
} Prevention
- Fetch fresh execution ids before canceling; don't reuse cached ones
- Check execution status before canceling
- Ensure the service account has write access to the application
- Treat 404 as 'already finished' in retry logic
When it happens
Trigger: `spin pipeline execution cancel <id>` where CancelPipeline.Execute() succeeds but resp.StatusCode != 200: execution id does not exist (404), execution already finished (409/400 depending on Gate version), or RBAC denial (403).
Common situations: Trying to cancel an execution that already completed; stale id from a cached/old list; user lacking write permission on the application; Gate restarted and lost the execution reference.
Related errors
- Encountered an error executing pipeline, status code
- Encountered an error getting execution
- Encountered an error getting pipeline in pipeline
- Encountered an error listing executions for pipeline id
- Encountered an error checking application existence, status…
AI-assisted analysis of spinnaker/spinnaker@1d4a5d0f6d (2026-09-10).
Data as JSON: /api/errors/80f97230a9392a4f.
Report an issue: GitHub.
Appendix: source
Thrown at spin/cmd/pipeline/execution/cancel.go:65
}
return cmd
}
func cancelExecution(cmd *cobra.Command, options *cancelOptions, args []string) error {
executionId, err := util.ReadArgsOrStdin(args)
if executionId == "" {
return errors.New("no execution id supplied, exiting")
}
resp, err := options.GateClient.PipelineControllerAPI.CancelPipeline(options.GateClient.Context,
executionId).Execute()
if err != nil {
return err
}
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("encountered an error canceling execution with id %s, status code: %d\n",
executionId,
resp.StatusCode)
}
options.Ui.Success(fmt.Sprintf("Execution %s successfully canceled", executionId))
return nil
}
View on GitHub (pinned to 1d4a5d0f6d)