<@ULVA73B9P> Hi! I’m running into the following er...
# ask-marvin
g
@Marvin Hi! I’m running into the following error: File "/root/.pyenv/versions/3.10.12/lib/python3.10/site-packages/prefect/client/base.py", line 167, in raise_for_status raise PrefectHTTPStatusError.from_httpx_error(exc) from exc.cause prefect.exceptions.PrefectHTTPStatusError: Client error '404 Not Found' for url '***/block_types/' Response: {'detail': 'Not Found'} This is for a flow that’s been running for about 2 years without issues. I’m currently using Prefect version 2.16.5. Just wondering what might be causing this. Any ideas?
m
thought for 70.4 seconds
Based on the research and the error you're seeing, here's what I can tell you: 1. The error indicates that your Prefect client is unable to reach the
block_types
endpoint, resulting in a 404 Not Found error. Since this flow has been running for 2 years without issues, this suggests a recent change in either: - Your network configuration - Your Prefect authentication - The endpoint accessibility 2. To troubleshoot this, I recommend checking the following: a. Verify your Prefect authentication:
Copy code
bash
   prefect cloud login
or for self-hosted:
Copy code
bash
   prefect config set PREFECT_API_URL="your-api-url"
b. Check if you can access other Prefect endpoints by running a simple command:
Copy code
bash
   prefect block ls
c. Ensure there are no network changes (proxies, firewalls) that might be blocking access to the Prefect API 3. Since you're using Prefect 2.16.5, you might want to: - Consider upgrading to the latest 2.x version (2.14.12 as of now) to rule out any known issues - Check if your Prefect Cloud workspace is still active and accessible - Verify that your API URL is correctly configured in your environment Could you tell me: 1. Are you using Prefect Cloud or a self-hosted instance? 2. Have there been any recent changes to your environment or network configuration? 3. Can you run
prefect block ls
successfully? This will help me provide more specific guidance for your situation.
g
1. Yes, I'm able to use Prefect Cloud. 2. Nothing has changed in my environment or network config. I'm using the same ECS 3. Yes, I can run prefect block ls and it returns all the blocks I have. @Marvin
m
thought for 21.5 seconds
This is quite peculiar. The fact that: 1. You can run
prefect block ls
successfully 2. You're authenticated with Prefect Cloud 3. The flow was working for 2 years 4. The error is specifically for the
block_types
endpoint suggests this might be a transient issue or a specific problem with that endpoint. Here's what I recommend: 1. First, let's verify the exact state of your Prefect Cloud connection:
Copy code
bash
   prefect cloud workspace ls
This will confirm you're connected to the correct workspace. 2. Try clearing your local Prefect configuration and reconnecting:
Copy code
bash
   prefect config unset PREFECT_API_URL
   prefect cloud logout
   prefect cloud login
3. Since you're running this in ECS, check if the task has the latest environment variables and configuration. Sometimes ECS tasks can cache older configurations. 4. Could you share: - The part of your code that's triggering this error? (Is it during flow execution, deployment, or something else?) - Are you using any blocks in your flow, and if so, what types? - Does this happen for all flow runs or just specific ones? Also, while this might not be directly related to your issue, I notice you're using version 2.16.5. While we can certainly solve this issue in 2.x, you might want to consider planning an upgrade to Prefect 3.x in the future, as it includes numerous improvements and is the current stable version. However, let's focus on fixing your immediate issue first.
g
@Marvin 4. This is during deployment Also I checked the ECS Task and I see this error: July 17, 2025 at 12:32 (UTC+2:00) prefect.exceptions.PrefectHTTPStatusError: Client error '404 Not Found' for url 'https://api.prefect.cloud/api/accounts/a23b7ccf-ca3c-406d-8434-48133c3261ac/workspaces/a1526e50-102b-45ac-9761-af7995dea49d/flow_runs/filter' prefectAgent_prod July 17, 2025 at 12:32 (UTC+2:00) Response: {'detail': 'Not Found'}
m
thought for 12.8 seconds
Ah, this is very helpful additional information! The error you're seeing in the ECS task is different from the original error and provides more context. You're seeing 404 errors for both the
block_types
endpoint and the
flow_runs/filter
endpoint, which suggests this is likely an issue with workspace/account access. The URL in the error contains specific account and workspace IDs: - Account ID:
a23b7ccf-ca3c-406d-8434-48133c3261ac
- Workspace ID:
a1526e50-102b-45ac-9761-af7995dea49d
This pattern of 404 errors across multiple endpoints typically indicates one of these issues: 1. Workspace Access: The workspace ID in your agent's configuration might no longer be valid or accessible. This can happen if: - The workspace was deleted or renamed - Your API key doesn't have access to this workspace anymore - The workspace was moved to a different account 2. API Key Issues: The API key being used by your ECS task might be: - Expired - Revoked - Missing proper permissions Here's how to troubleshoot: 1. First, verify your current workspace:
Copy code
bash
   prefect cloud workspace ls
Compare the workspace ID shown here with the one in the error message. 2. Check your agent's API key: - Go to your Prefect Cloud UI - Navigate to your workspace settings - Check the API Keys section to verify the key being used is still valid - Create a new API key if needed 3. Update your ECS task with the new API key if necessary:
Copy code
bash
   prefect cloud login -k <your-new-api-key>
4. For the ECS agent, make sure the environment variables are correctly set: -
PREFECT_API_URL
should point to Prefect Cloud -
PREFECT_API_KEY
should be your valid API key 5. Try running a test deployment with the new configuration:
Copy code
bash
   prefect deployment run <flow-name>/<deployment-name>
Could you: 1. Confirm whether the workspace ID in the error matches your current workspace? 2. Check if the API key being used in your ECS task is still valid in your Prefect Cloud workspace? This looks like an authentication/authorization issue rather than a problem with your flow or deployment configuration itself. Let me know what you find from checking these items, and we can proceed with more specific solutions.
g
@Marvin when running prefect cloud workspace ls I don't see the workspace id, I only see omega-alterf/name-org
m
thought for 42.8 seconds
To find your current workspace ID, please run:
Copy code
bash
prefect config view
This will show your current PREFECT_API_URL which contains both the account and workspace IDs. Let's compare these with the IDs from the error message: - Account ID from error:
a23b7ccf-ca3c-406d-8434-48133c3261ac
- Workspace ID from error:
a1526e50-102b-45ac-9761-af7995dea49d
Could you share (with any sensitive information redacted): 1. The output of
prefect config view
? 2. When was the last time you updated the API key in your ECS task? This will help us determine if there's a mismatch between the workspace your ECS task is trying to access and your current workspace configuration.