Any idea what might be causing errors with artifac...
# prefect-community
Any idea what might be causing errors with artifact generation? I’m getting these errors in my task runs:
Copy code
Error during execution of task: ClientError([{'path': ['create_task_run_artifact'], 'message': 'Task run <task_run_id> not found', 'extensions': {'code': 'INTERNAL_SERVER_ERROR'}}])
I think so. Artifacts are attached to tasks and use the task id as an identifier. You might be making one outside of a task?
it’s made from the task that it’s in.
Or at least I was trying to call create artifact from within the method
Maybe we can try to grab it from text to pass it in manually one sec
So it’s tried to just pull it but I guess it can’t. Is that a
inside a
inside a
? Or just a not in a Flow?
something like
Copy code
class Task():
  def run():
    # do something

task = Task()

with Flow("my flow") as Flow:
This looks pretty right to me. Would you be able to give me a minimal example?
Or I can try in a couple of hours
I don’t think this is an easily reproducable issue. The problem occurred in a few mapped tasks of a flow run. I can DM you the IDs of the tasks if you want so you can try and locate the logs of those attempts. The errors indicate that there could be something possibly logged on the prefect cloud side that might let you know what the problem was.
We dont have any more logs than the ones you see either on your Flow. Can test this tonight.
So I got around to trying, is your code just something like this?
Copy code
from prefect import Task, Flow
from prefect.backend.artifacts import create_markdown_artifact

class MyTask(Task):
    def run(self, x):
        create_markdown_artifact("# Heading\n\nText with [link](<>).")

mytask = MyTask()
with Flow("artifact_test") as flow:

yeah exactly
we run it on docker agent with local dask executor if that makes any difference
I dont think the docker agent will affect but I can try the local dask executor
I am facing the same issue with a mapped task that calls
. This was working fine for us for the last few weeks, but this error was thrown multiple times yesterday. We are using LocalDaskExecutor with a Kubernetes agent.