<@ULVA73B9P> How can I fix the following error? ``...
# ask-marvin
f
@Marvin How can I fix the following error?
Copy code
Flow run infrastructure exited with non-zero status code:
 Task prefect-enthusiastic-alligator-97f4p-task0 failed with message: Internal error. (Error Code: 1)
This may be caused by attempting to run an image with a misspecified platform or architecture.
m
To address the error you’re encountering, follow these steps: 1. Check Flow Run Configuration: Ensure that the platform or architecture specified for the flow run is compatible with the underlying infrastructure. This error often arises due to mismatched configurations. 2. Kill Inactive Infrastructure: Prefect does not automatically kill infrastructure if a job fails. You need to implement this manually. Here's an example of an improved function:
Copy code
python
async def _submit_run_and_capture_errors(
    self, flow_run: "FlowRun", task_status: anyio.abc.TaskStatus = None
) -> Union[BaseWorkerResult, Exception]:
    # Existing code until status_code check
    if result.status_code != 0:
        try:
            await self.kill_infrastructure(
                infrastructure_pid=flow_run.infrastructure_pid,
                configuration=configuration,
            )
        except NotImplementedError:
            self._logger.error(
                f"Worker type {self.type!r} does not support killing created "
                "infrastructure. Cleanup cannot be guaranteed."
            )
        await self._propose_crashed_state(
            flow_run,
            (
                f"Flow run infrastructure exited with non-zero status code "
                f"{result.status_code}."
            ),
        )

    self._emit_flow_run_executed_event(result, configuration, submitted_event)

    return result
3. Additional Context from GitHub Issues: Review related GitHub issues for more context and potential fixes. Here are a few relevant issues: - Ensure infrastructure is always killed when a job has crashed - Handle failed Kubernetes scheduling events more gracefully - CannotPullContainerError for failed Task For detailed troubleshooting steps, you can refer to the Prefect GCP integration documentation. If this does not resolve the issue, consider providing additional logs or context to further diagnose the problem.