cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Administration & Architecture
Explore discussions on Databricks administration, deployment strategies, and architectural best practices. Connect with administrators and architects to optimize your Databricks environment for performance, scalability, and security.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Only absolute paths are currently supported. Paths must begin with '/'

AxelM
New Contributor

I am facing the above issue when using the Python Databricks SDK. I retreive the job-definition by "

client.jobs.get()" and then try to create it on another workspace with
"client.jobs.create()"

Therefore the job-definition is correct and working fine on the source workspace. Also relative paths are mandatory, as I am using a Git Reference to target the Notebook




3 REPLIES 3

mark_ott
Databricks Employee
Databricks Employee

The error "Only absolute paths are currently supported. Paths must begin with '/'" in the context of the Databricks Python SDK means that when creating a job, the notebook path you provide must be an absolute workspace path (like /Users/username/notebook) rather than a relative path or a Git reference.โ€‹

Explanation of the Issue

  • The Databricks Jobs API (used via client.jobs.create()) expects the notebook path in the job definition to be an absolute path in the Databricks workspace filesystem, not a Git URL or a relative path.โ€‹

  • Even if you're working with Git-linked notebooks, when defining a job, the "notebook_path" field must always use an absolute path that exists in the workspace (e.g., /Repos/username/repo-name/path/to/notebook).โ€‹

How to Fix

  • Make sure that when you migrate a job between workspaces, the notebook referenced in the job is present in the destination workspace, and specify its absolute path in the job definition.

  • If you're using Git integration, use the absolute workspace path of the notebook synced from Git, not the Git reference or a relative path.โ€‹

  • Example:

    python
    job_settings = { "notebook_task": { "notebook_path": "/Repos/username/repo-name/path/to/notebook" }, # other job settings... } client.jobs.create(**job_settings)

Note on CI/CD and Git References

  • If your workflow requires Git-based deployment (to keep test and production in sync), you must automate a step that pulls or syncs the notebooks from Git into the workspace and then reference those absolute paths in the job configuration.

  • At this time, the Databricks Jobs API does not support specifying jobs directly referencing a Git branch/tag/commit for the taskโ€”jobs work off workspace objects, not directly from Git links.โ€‹

Summary Table

Solution Step Details
Use absolute notebook paths Path must begin with '/', referencing the workspace location of the notebook
Sync notebooks from Git before deploy Ensure the needed notebook exists in the destination workspace
No direct Git refs in job creation The Jobs API does not accept Git refs/tagsโ€”only absolute workspace paths allowed
 
 

Following these steps should resolve the "Only absolute paths are currently supported" error when using the Databricks Python SDK to migrate or create jobs with notebooks.โ€‹

kylebennison
New Contributor II

@AxelM I see this was a while ago, what was your solution? In my experience, either the `source` field under notebook task is incorrectly set to "WORKSPACE" instead of "GIT", or there's a legitimate issue, such as:

  • a typo/mismatch between the specified path and the actual path
  • a tag, branch, etc. which the job was originally deployed to target has been changed or deleted

@ROTT 

The Jobs API does not accept Git refs/tagsโ€”only absolute workspace paths allowed

This is not accurate.

From the docs, we see the jobs create API takes a git source option: https://docs.databricks.com/api/workspace/jobs/create#git_source

When that is specified, then other tasks, such as notebook task, require a relative reference, as OP correctly pointed out.

The notebook task parameter specifies that you must use relative paths if using git-source: https://docs.databricks.com/api/workspace/jobs/create#tasks-notebook_task-notebook_path 

 

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.