--- title: "ADR 0102: startPR returns the created PipelineRun together with a status error" --- * Status: accepted * Code: [`pkg/pipelineascode/pipelineascode.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/pipelineascode/pipelineascode.go) ## Context `startPR` creates the PipelineRun on the cluster, then posts the `in_progress` status to the provider. The provider call can fail after the run exists. The goroutine in `Run` that calls `startPR` reacts to an error by posting a failure status, and then still uses `pr`: it records it for follow-ups, hands it to `manager.AddPipelineRun` and to `cancelInProgressMatchingPipelineRun`. ## Decision * When `CreateStatus` fails, `startPR` returns the created `pr` with the wrapped error (`cannot use the API on the provider platform to create a in_progress status`), not `nil`. * Callers must check `pr != nil` independently of `err`; `Run` does so before recording the run. ## Consequences * A provider outage does not hide a run that is already running from queue management and cancel-in-progress. * The logURL patch after the status call is skipped in this case, so such a run has no `LogURL` annotation from this path. * `TestStartPRStatusCreationFailure` pins both the non-nil run and the error text.