Can't catch {:badmatch, ""} in my Oban job

I’m trying to figure out where ** (EXIT from #PID<0.156223.0>) {:badmatch, ""} is coming from in some discarded Oban jobs. I surrounded my job’s perform() function with a try, rescue, catch block which reraises everything with a more descriptive error, but this doesn’t occur.

Any tips on figuring out where this is occurring? I know I’m looking at the right module. If I retry my discarded job, it succeeds.

Here’s my Worker configuration.

  use Oban.Worker,
    queue: :my_queue,
    max_attempts: 1,
    unique: [
      # Ensure only one job is running for a given set of out_dirs
      keys: [:out_dirs, :project_id],
      # Only consider the :available and :scheduled states
      # If a job is already running, allow a new job to be scheduled.
      # If a job is waiting to run, don't allow a new job to be scheduled.
      states: [:available, :scheduled]
    ]

and my perform function

  @impl Oban.Worker
  def perform(%Oban.Job{args: args}) do
    try do
      ...
    rescue
      error ->
        raise {error, "Error in job"}
    catch
      other ->
        raise {other, "Unexpected error in job"}
    end
  end

Even with all of that, I still see the following in Oban Web.

EDIT: I added a retry: 3, which caused one such job to fail 3 times in a row, which was surprising because manually retrying the job ended in a success state.

The exit is coming from a linked process. Are you starting a process from within perform/1?

1 Like

Yeah, it might be from DenoRider, an interface to Deno which I use to execute JavaScript on my data.

Or maybe it’s from the Python process which I use to interface with the KuzuDB library for Python.

It’s annoying to reproduce because it’s so random. I was hoping I could trap the exit somehow and write a special log statement to narrow down who is the culprit, but I’m not sure how to do that / if it’s possible.