{"record":{"id":"2c407488bb630483","repo":"spinnaker/spinnaker","slug":"execute-pipeline-failed-with-response-v-and-erro","errorCode":null,"errorMessage":"Execute pipeline failed with response: %v and error: %s\n","messagePattern":"Execute pipeline failed with response: (.+?) and error: (.+?)\n","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"spin/cmd/pipeline/execute.go","lineNumber":114,"sourceCode":"\t\t\t\"type\": \"manual\",\n\t\t},\n\t}\n\tif len(parameters) > 0 {\n\t\ttrigger[\"trigger\"][\"parameters\"] = parameters\n\t}\n\n\tif _, ok := artifactsFile[\"artifacts\"]; ok {\n\t\tartifacts := artifactsFile[\"artifacts\"].([]interface{})\n\t\tif len(artifacts) > 0 {\n\t\t\ttrigger[\"trigger\"][\"artifacts\"] = artifacts\n\t\t}\n\t}\n\n\t_, resp, err := options.GateClient.PipelineControllerAPI.InvokePipelineConfig(options.GateClient.Context,\n\t\toptions.application,\n\t\toptions.name).RequestBody(trigger).Execute()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Execute pipeline failed with response: %v and error: %s\\n\", resp, err)\n\t}\n\n\tif resp.StatusCode != http.StatusAccepted {\n\t\treturn fmt.Errorf(\"Encountered an error executing pipeline, status code: %d\\n\", resp.StatusCode)\n\t}\n\n\toptions.Ui.Success(\"Pipeline execution started\")\n\n\treturn nil\n}\n","sourceCodeStart":96,"sourceCodeEnd":125,"githubUrl":"https://github.com/spinnaker/spinnaker/blob/1d4a5d0f6d10d0232b1af077decd559b68a94a5e/spin/cmd/pipeline/execute.go#L96-L125","documentation":"This error is returned by executePipeline in the spin CLI when the Gate API call to invoke a pipeline (InvokePipelineConfig) returns a transport-level error. The CLI wraps the HTTP response body and the underlying error into a single message so the developer can see both what the server responded and why the request failed. It does not indicate the pipeline ran and failed; it means the invocation request itself did not succeed.","triggerScenarios":"Calling `spin pipeline execute` where the Gate client's PipelineControllerAPI.InvokePipelineConfig(...).Execute() returns a non-nil error: Gate unreachable, 401/403 auth failure, unknown application or pipeline name (404), malformed trigger payload, or TLS/network errors.","commonSituations":"Wrong gate endpoint or --gate-endpoint configured; expired or missing auth token; typo in application or pipeline name; pipeline config deleted in Spinnaker while the CLI script still references it; corporate proxy blocking the request.","solutions":["Check the response and error text in the message: a 404 means the application/pipeline name is wrong, a 401/403 means credentials are bad","Verify connectivity to Gate: curl the configured gate endpoint's health endpoint","Confirm the pipeline exists: `spin pipeline list --application <app>`","Re-authenticate or refresh credentials (e.g. `spin auth` config or update ~/.spin/config)","If a proxy/firewall is involved, fix proxy env vars or allowlist the Gate host"],"exampleFix":"// before: retries blindly and hides the cause\nif _, err := runPipeline(app, name); err != nil {\n    log.Fatal(err)\n}\n// after: inspect status-specific causes\nif _, err := runPipeline(app, name); err != nil {\n    var respErr *gate.GenericOpenAPIError\n    if errors.As(err, &respErr) && strings.Contains(respErr.Error(), \"404\") {\n        log.Fatalf(\"pipeline %s/%s not found in Spinnaker\", app, name)\n    }\n    log.Fatal(err)\n}","handlingStrategy":"try-catch","validationCode":"// Go: validate inputs and endpoint before invoking\nif options.application == \"\" || options.name == \"\" {\n    return errors.New(\"application and pipeline name are required\")\n}\nif options.GateClient == nil {\n    return errors.New(\"gate client not configured; check ~/.spin/config\")\n}","typeGuard":"func hasGateClient(o *executeOptions) bool { return o != nil && o.GateClient != nil && o.GateClient.Context != nil }","tryCatchPattern":"resp, err := req.Execute()\nif err != nil {\n    var apiErr *gate.GenericOpenAPIError\n    if errors.As(err, &apiErr) {\n        return fmt.Errorf(\"gate rejected invocation: %w (check app/name and auth)\", apiErr)\n    }\n    return err // network-level failure\n}","preventionTips":["Verify application/pipeline names with `spin pipeline list` before executing","Keep ~/.spin/config gate endpoint and auth current","Add a connectivity smoke test (gate /health) to scripts before invoking pipelines","Handle 401/403/404 distinctly in automation rather than failing generically"],"tags":["cli","http","network","gate-api"],"backgroundTag":"api-request-failed","analyzedSha":"1d4a5d0f6d10d0232b1af077decd559b68a94a5e","analyzedAt":"2026-09-10T14:13:07.222Z","contentChangedAt":"2026-09-10T14:13:07.222Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}