{"record":{"id":"4bdf446f3b3e3dd9","repo":"apache/beam","slug":"failed-to-submit-job","errorCode":null,"errorMessage":"failed to submit job","messagePattern":"failed to submit job","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/runners/universal/runnerlib/job.go","lineNumber":93,"sourceCode":"\t\tJobName:         opt.Name,\n\t}\n\tresp, err := client.Prepare(ctx, req)\n\tif err != nil {\n\t\treturn \"\", \"\", \"\", errors.Wrap(err, \"job failed to prepare\")\n\t}\n\treturn resp.GetPreparationId(), resp.GetArtifactStagingEndpoint().GetUrl(), resp.GetStagingSessionToken(), nil\n}\n\n// Submit submits a job to the given job service. It returns a jobID, if successful.\nfunc Submit(ctx context.Context, client jobpb.JobServiceClient, id, token string) (string, error) {\n\treq := &jobpb.RunJobRequest{\n\t\tPreparationId:  id,\n\t\tRetrievalToken: token,\n\t}\n\n\tresp, err := client.Run(ctx, req)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"failed to submit job\")\n\t}\n\treturn resp.GetJobId(), nil\n}\n\n// WaitForCompletion monitors the given job until completion. It logs any messages\n// and state changes received.\nfunc WaitForCompletion(ctx context.Context, client jobpb.JobServiceClient, jobID string) error {\n\tstream, err := client.GetMessageStream(ctx, &jobpb.JobMessagesRequest{JobId: jobID})\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to get job stream\")\n\t}\n\n\tmostRecentError := \"<no error received>\"\n\tvar errReceived, jobFailed bool\n\n\tfor {\n\t\tmsg, err := stream.Recv()\n\t\tif err != nil {","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/universal/runnerlib/job.go#L75-L111","documentation":"Submit starts a prepared job by calling the JobService Run RPC. If that RPC fails, the error is wrapped as \"failed to submit job\". Preparation succeeded, but the runner refused or failed to begin executing the job.","triggerScenarios":"client.Run(ctx, req) errors during Submit, called from Execute after a successful Prepare with a valid preparation id and staging token.","commonSituations":"Stale/expired preparation id or staging session token; runner overloaded or failing while starting workers; artifact staging not yet complete; transient gRPC errors between prepare and run.","solutions":["Retry the whole submission (Prepare + Submit) — preparation ids are per-submission and may expire.","Inspect the wrapped gRPC status for the runner-side reason (quota, capacity, invalid state).","Verify artifact staging succeeded and the staging token is current.","Check runner service logs/health if failures persist."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for attempt := 0; attempt < 3; attempt++ {\n    res, err := beam.Run(ctx, runner, p)\n    if err != nil && strings.Contains(err.Error(), \"failed to submit job\") { time.Sleep(backoff); continue }\n    break\n}","preventionTips":["Retry the full prepare+submit flow — preparation ids expire between calls.","Ensure artifact staging completes before Run.","Monitor runner capacity/quota for busy clusters.","Log the wrapped gRPC status code to distinguish transient vs. permanent causes."],"tags":["go","beam","grpc","job-submission"],"backgroundTag":"api-request-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}