apache/beam · error
GetJobMetrics: unknown jobID: %v
Error message
GetJobMetrics: unknown jobID: %v
What it means
Error returned by the Prism job server's GetJobMetrics gRPC handler when the request's job ID does not match any job known to the server (getJob returned nil). Typically means the job already expired from the store, was submitted to a different Prism instance, or the ID is malformed.
Source
Thrown at sdks/go/pkg/beam/runners/prism/internal/jobservices/management.go:510
curState = job.stateIdx + 1
job.streamCond.L.Unlock()
stream.Send(&jobpb.JobMessagesResponse{
Response: &jobpb.JobMessagesResponse_StateResponse{
StateResponse: &jobpb.JobStateEvent{
State: state,
},
},
})
job.streamCond.L.Lock()
}
}
}
// GetJobMetrics Fetch metrics for a given job.
func (s *Server) GetJobMetrics(ctx context.Context, req *jobpb.GetJobMetricsRequest) (*jobpb.GetJobMetricsResponse, error) {
j := s.getJob(req.GetJobId())
if j == nil {
return nil, fmt.Errorf("GetJobMetrics: unknown jobID: %v", req.GetJobId())
}
return &jobpb.GetJobMetricsResponse{
Metrics: &jobpb.MetricResults{
Attempted: j.metrics.Results(tentative),
Committed: j.metrics.Results(committed),
},
}, nil
}
// GetJobs returns the set of active jobs and associated metadata.
func (s *Server) GetJobs(context.Context, *jobpb.GetJobsRequest) (*jobpb.GetJobsResponse, error) {
s.mu.Lock()
defer s.mu.Unlock()
resp := &jobpb.GetJobsResponse{}
for key, job := range s.jobs {
resp.JobInfo = append(resp.JobInfo, &jobpb.JobInfo{
JobId: key,View on GitHub (pinned to 12126d8942)
Solutions
- Use the job ID returned by the current run, not one copied from stale output.
- Query metrics while the job still exists on the same server instance.
- Confirm you're connected to the prism server that executed the job.
- Wrap the call to handle 'unknown jobID' by re-creating or re-running the job.
Defensive patterns
Strategy: try-catch
Validate before calling
if jobID == "" || jobID != runningJobID {
return errors.New("cannot fetch metrics: unknown job id")
} Try / catch
resp, err := client.GetJobMetrics(ctx, req)
if err != nil && strings.Contains(err.Error(), "unknown jobID") {
return nil, fmt.Errorf("job %s no longer available on this server: %w", req.GetJobId(), err)
} Prevention
- Poll metrics while the job is still tracked by the same server instance.
- Store the job ID from the Run response rather than parsing logs.
- Point metric queries at the server that actually executed the job.
When it happens
Trigger: Calling the GetJobMetrics RPC with a GetJobMetricsRequest whose JobId matches no prepared/running job (unknown or expired ID).
Common situations: Polling metrics after job completion once the server dropped it; querying metrics from a different prism instance than the one that ran the job; typo'd job ID from logs.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- job with id %v not found
- failed to get metrics
- Job {} does not exist
- endpoint not defined
- failed to read metadata from context
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/931636c9c0b679cb.
Report an issue: GitHub.