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

Need to improve error message for payload field type mismatches #1764

Open
DingzheLiTubi opened this issue Sep 10, 2024 · 1 comment
Open
Assignees
Labels
CLI CLI related issues Enhancement New feature or request

Comments

@DingzheLiTubi
Copy link

Describe the issue

given a job json payload with some field type mismatches like the example below. e.g. a string "true" provided for a field expecting bool true.
when we run databricks cli actions like create job/job reset with that malformed json payload, databricks cli will return an error message Error: invalid character '\n' in string literal which does not help debugging at all.

it would be the best if databricks cli could produce more meaningful error message to help easier identifying the real issue.

Steps to reproduce the behavior

databricks jobs reset --json @/job_payload
// will return `Error: invalid character '\n' in string literal`
// hard to quickly identify the real cause of failure
cat /job_payload
{
    // omit a bunch of settings
  "job_id": xxx,
  "new_settings": {
    "name": "xxx",
    "email_notifications": {
      "on_start": [],
      "on_success": [],
      "on_failure": []
    },
    "webhook_notifications": {
      "on_start": [],
      "on_failure": []
    },
    "notification_settings": {
      "no_alert_for_skipped_runs": true,
      "no_alert_for_canceled_runs": true
    },
    "timeout_seconds": 0,
    "max_concurrent_runs": 1,
    "tasks": [
      {
        "task_key": "xxx",
        "spark_jar_task": {
          // ...
        },
        "new_cluster": {
          //...
        },
        "libraries": [
          //...
        ],
        "email_notifications": {},
        "notification_settings": {},
        "timeout_seconds": 0,
        "max_retries": 0,
        "min_retry_interval_millis": 0,
        "retry_on_timeout": "true" // here is the problem, retry_on_timeout should provide a bool true instead of string "true"
      }
    ]
  }
}

Expected Behavior

hopefully cli error message can point to the real problem in the json payload. e.g. something like string provided for `retry_on_timeout` but expecting boolean can help a lot

OS and CLI version

v0.221.1

@DingzheLiTubi DingzheLiTubi added the CLI CLI related issues label Sep 10, 2024
@andrewnester andrewnester added the Enhancement New feature or request label Sep 10, 2024
@pietern
Copy link
Contributor

pietern commented Sep 10, 2024

I agree; this would be great to have.

Related POC in #1171.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI CLI related issues Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants