iyashk-DB
Databricks Employee
Databricks Employee
You’re hitting a Jobs validation rule that depends on where the notebook is sourced from. With Git-sourced jobs, notebook paths must be relative; with workspace-sourced jobs, paths must be absolute and start with “/”.
If a task’s source is treated as WORKSPACE (explicitly or by default), the task’s notebook_path must be an absolute workspace path (for example, “/Users/…”, “/Repos/…”, “/Workspace/…”). A relative path will trigger “Only absolute paths are currently supported. Paths must begin with ‘/’.”
  • For tasks that use GIT as the source, the task’s notebook_path must be a path relative to the repo root, and absolute paths are rejected. If the job or task isn’t correctly marked as GIT-sourced, the API will think it’s workspace-sourced and enforce absolute paths.
  • A common pitfall is placing git_source on the task instead of the job. Jobs expect git_source at the job level; once set, tasks can either omit source (it defaults to GIT when job.git_source is present) or explicitly set source="GIT". Putting git_source on a task leads to exactly the error you saw; moving git_source to the job fixes it.
Ensure the job-level git_source is set and each notebook task uses a relative notebook_path with source="GIT" (or omit source to default to GIT when git_source is present):
from databricks.sdk import WorkspaceClient
from databricks.sdk.service.jobs import Task, NotebookTask, Source, GitSource

w = WorkspaceClient()

j = w.jobs.create(
    name="Migrated job",
    git_source=GitSource(
        git_url="https://github.com/<org>/<repo>.git",
        git_provider="gitHub",      # or "azureDevOpsServices", "bitbucketCloud", ...
        git_branch="main"           # or set git_commit
    ),
    tasks=[
        Task(
            task_key="my_task",
            # Path is relative to the repo root:
            notebook_task=NotebookTask(
                notebook_path="path/to/notebook.py",
                source=Source.GIT        # or omit source to default to GIT when job.git_source is set
            ),
            # ... compute settings ...
        ),
        # more tasks...
    ]
)
If task source is WORKSPACE, notebook_path must be absolute and start with “/”. If task source is GIT, notebook_path must be relative to the repo root, and the job must have git_source defined at the job level.
Leaving task.source empty will make the task use GIT when job.git_source is defined; otherwise it uses WORKSPACE.
 
If you’re cloning into the workspace (Repos), if you want to run a notebook checked out into workspace Repos (not directly from a remote Git reference), set source="WORKSPACE" and use an absolute path like “/Repos/<owner>/<repo>/<subpath>”. Relative paths won’t work in this mode.
 
Migrating with client.jobs.get() → client.jobs.create() When you copy settings across workspaces: * Normalize tasks to either WORKSPACE+absolute paths, or GIT+relative paths with job.git_source set. Don’t mix them unintentionally; otherwise, you’ll hit the absolute/relative path errors. If the source workspace had git_source configured, ensure you carry it over at the job level in the target workspace; don’t attach git_source to individual tasks.