Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbt cli snapshot plugin fails with UnsupportedOperationException #178

Closed
craigbloodworth opened this issue Mar 6, 2025 · 5 comments
Closed
Assignees
Labels
area/plugin Plugin-related issue or feature request bug Something isn't working

Comments

@craigbloodworth
Copy link

Describe the issue

Since the latest update to 0.21.4 a task to clone a repo from Github and then run the code in a Docker runner immediately fails with the error: java.lang.UnsupportedOperationException.

Job:

 - id: finalSnapshot_clone_repository
    type: io.kestra.plugin.git.Clone
    url: https://github.com/[...repo...]
    branch: main

  - id: finalSnapshot_dbt_snapshot
    type: io.kestra.plugin.dbt.cli.Snapshot
    debug: true
    dbtPath: /usr/local/bin/dbt
    taskRunner:
      type: io.kestra.plugin.scripts.runner.docker.Docker
      fileHandlingStrategy: MOUNT
      delete: true
      networkMode: host
    containerImage: docker.io/craigbloodworth/dbt-sqlserver:latest
    profiles: |

finalSnapshot_dbt_snapshot log:

2025-03-06T07:20:30.928Z TRACE java.lang.UnsupportedOperationException
	at java.base/java.util.AbstractMap.put(Unknown Source)
	at java.base/java.util.AbstractMap.putAll(Unknown Source)
	at io.kestra.plugin.scripts.exec.scripts.runners.CommandsWrapper.addEnv(CommandsWrapper.java:147)
	at io.kestra.plugin.dbt.cli.AbstractDbt.run(AbstractDbt.java:178)
	at io.kestra.plugin.dbt.cli.AbstractDbt.run(AbstractDbt.java:34)
	at io.kestra.core.runners.WorkerTaskCallable.doCall(WorkerTaskCallable.java:78)
	at io.kestra.core.runners.AbstractWorkerCallable.call(AbstractWorkerCallable.java:62)
	at io.kestra.core.runners.WorkerSecurityService.callInSecurityContext(WorkerSecurityService.java:10)
	at io.kestra.core.runners.Worker.lambda$callJob$19(Worker.java:837)
	at io.kestra.core.trace.NoopTracer.inCurrentContext(NoopTracer.java:15)
	at io.kestra.core.runners.Worker.callJob(Worker.java:833)
	at io.kestra.core.runners.Worker.runAttempt(Worker.java:792)
	at io.kestra.core.runners.Worker.run(Worker.java:640)
	at io.kestra.core.runners.Worker.handleTask(Worker.java:372)
	at io.kestra.core.runners.Worker.lambda$run$8(Worker.java:261)
	at io.micrometer.core.instrument.internal.TimedRunnable.run(TimedRunnable.java:49)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

Environment

  • Kestra Version: 0.21.4
@craigbloodworth craigbloodworth added area/backend Needs backend code changes area/frontend Needs frontend code changes bug Something isn't working labels Mar 6, 2025
@github-project-automation github-project-automation bot moved this to Backlog in Issues Mar 6, 2025
@Ben8t
Copy link
Member

Ben8t commented Mar 6, 2025

Still investigating, but I'm not able to reproduce with this flow on our develop version:

id: dbt_snapshot
namespace: company.team

tasks:
  - id: working_directory
    type: io.kestra.plugin.core.flow.WorkingDirectory
    tasks:
      - id: clone_repository
        type: io.kestra.plugin.git.Clone
        url: https://github.com/kestra-io/dbt-demo
        branch: main
      
      - id: dbt_snapshot
        type: io.kestra.plugin.dbt.cli.Snapshot
        taskRunner:
          type: io.kestra.plugin.scripts.runner.docker.Docker
        dbtPath: /usr/local/bin/dbt
        containerImage: ghcr.io/kestra-io/dbt-duckdb
        profiles: |
          jaffle_shop:
            outputs:
              dev:
                type: duckdb
                path: ':memory:'
                extensions:
                  - parquet
            target: dev

image

@Ben8t
Copy link
Member

Ben8t commented Mar 6, 2025

Update: I'm able to reproduce on 0.21.5 and with other dbt tasks

image

@Ben8t
Copy link
Member

Ben8t commented Mar 6, 2025

This works though (using dbt cli task):

id: dbt_snapshot
namespace: company.team

tasks:
  - id: dbt
    type: io.kestra.plugin.core.flow.WorkingDirectory
    tasks:
      - id: cloneRepository
        type: io.kestra.plugin.git.Clone
        url: https://github.com/kestra-io/dbt-example
        branch: main
      - id: dbt-build
        type: io.kestra.plugin.dbt.cli.DbtCLI
        containerImage: ghcr.io/kestra-io/dbt-duckdb:latest
        taskRunner:
          type: io.kestra.plugin.scripts.runner.docker.Docker
        commands:
          - dbt snapshot
        profiles: |
          my_dbt_project:
            outputs:
              dev:
                type: duckdb
                path: ":memory:"
            target: dev

so it seems an issue related to wrapper tasks of dbt (Run, Build, Snapshot, etc.)

@Ben8t Ben8t transferred this issue from kestra-io/kestra Mar 6, 2025
@Ben8t Ben8t added area/plugin Plugin-related issue or feature request and removed area/backend Needs backend code changes area/frontend Needs frontend code changes labels Mar 6, 2025
@craigbloodworth
Copy link
Author

craigbloodworth commented Mar 6, 2025

Yes, I can confirm switching to DbtCLI works for me too. Thanks so much for the work around @Ben8t, really appreciate you jumping on it so quickly

@mgabelle
Copy link
Contributor

mgabelle commented Mar 6, 2025

Issue fixed in : PR
This will be available in the next bugfix release.

@Ben8t Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugin Plugin-related issue or feature request bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

3 participants