Skip to content

Commit b34e44c

Browse files
committed
Fix Fast slow store Not Found error by returning failed precondition
1 parent a7d873a commit b34e44c

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

nativelink-worker/src/local_worker.rs

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,11 +369,34 @@ impl<'a, T: WorkerApiClientTrait + 'static, U: RunningActionsManager> LocalWorke
369369
.err_tip(|| "Error while calling execution_response")?;
370370
},
371371
Err(e) => {
372-
grpc_client.execution_response(ExecuteResult{
373-
instance_name,
374-
operation_id,
375-
result: Some(execute_result::Result::InternalError(e.into())),
376-
}).await.err_tip(|| "Error calling execution_response with error")?;
372+
let is_cas_blob_missing = e.code == Code::NotFound
373+
&& e.message_string().contains("not found in either fast or slow store");
374+
if is_cas_blob_missing {
375+
warn!(
376+
?e,
377+
"Missing CAS inputs during prepare_action, returning FAILED_PRECONDITION"
378+
);
379+
let action_result = ActionResult {
380+
error: Some(make_err!(
381+
Code::FailedPrecondition,
382+
"{}",
383+
e.message_string()
384+
)),
385+
..ActionResult::default()
386+
};
387+
let action_stage = ActionStage::Completed(action_result);
388+
grpc_client.execution_response(ExecuteResult{
389+
instance_name,
390+
operation_id,
391+
result: Some(execute_result::Result::ExecuteResponse(action_stage.into())),
392+
}).await.err_tip(|| "Error calling execution_response with missing inputs")?;
393+
} else {
394+
grpc_client.execution_response(ExecuteResult{
395+
instance_name,
396+
operation_id,
397+
result: Some(execute_result::Result::InternalError(e.into())),
398+
}).await.err_tip(|| "Error calling execution_response with error")?;
399+
}
377400
},
378401
}
379402
Ok(())

0 commit comments

Comments
 (0)