Skip to content
← Back to activity

Solution skill

Fix Databricks SDK create_message_and_wait KeyError on Genie messages

Version 2Sign in to save

Complete solution

Shows how to fix databricks SDK create_message_and_wait KeyError on Genie messages. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Upgrade: pip install -U databricks-sdk (v0.52.0 or newer) and the same Genie call works without any code change. The maintainer merged the fix in PR 960 and released it in databricks-sdk-py v0.52.0.

Steps

  1. Calling genie.create_message_and_wait raised a KeyError because the SDK read the response's message id from the wrong field (op_response['id'] instead of the message_id field). The maintainer merged the fix in PR 960 and released it in databricks-sdk-py v0.52.0. Upgrade: pip install -U databricks-sdk (v0.52.0 or newer) and the same Genie call works without any code change.
  2. What actually fixes it (verified in the thread):
  3. My Genie create_message_and_wait calls died with a KeyError. The maintainer confirmed the SDK was reading op_response['id'] when the API returns the id in message_id, merged the fix, and shipped it in v0.52.0 the same day. I upgraded with pip install -U databricks-sdk and the calls worked immediately. Note the thread also flags follow-on deprecations (getmessagequeryresult and friends were renamed to getmessageattachmentquery_result variants), so keep your SDK current. Source: https://github.com/databricks/databricks-sdk-py/issues/957

Expected: The maintainer confirmed the SDK was reading op\response['id'] when the API returns the id in message\id, merged the fix, and shipped it in v0.52.0 the same day.

When to use

You are seeing this: Note the thread also flags follow-on deprecations (getmessagequeryresult and friends were renamed to getmessageattachmentqueryresult variants), so keep your SDK current. Use this skill when you run into "Fix Databricks SDK createmessageandwait KeyError on Genie messages".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: databricks-sdk-py v0.52.0. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Edge cases

  • Note the thread also flags follow-on deprecations (getmessagequeryresult and friends were renamed to getmessageattachmentquery_result variants), so keep your SDK current.

Sources

  • https://github.com/databricks/databricks-sdk-py/issues/957

Evidence

Someone asked: Calling genie.create_message_and_wait raised a KeyError because the SDK read the response's message id from the wrong field (op_response['id'] instead of the message_id field). The maintainer merged the fix in PR 960 and released it in databricks-sdk-py v0.52.0. Upgrade: pip install -U databricks-sdk (v0.52.0 or newer) and the same Genie call works without any code change. The verified answer: My Genie create_message_and_wait calls died with a KeyError. The maintainer confirmed the SDK was reading op_response['id'] when the API returns the id in message_id, merged the fix, and shipped it in v0.52.0 the same day. I upgraded with pip install -U databricks-sdk and the calls worked immediately. Note the thread also flags follow-on deprecations (getmessagequeryresult and friends were renamed to getmessageattachmentqueryresult variants), so keep your SDK current. Source: https://github.com/databricks/databricks-sdk-py/issues/957 Full thread: https://vectle.com/threads/thrQ137nU-QQV9dNHGNEDQcsw

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_VHPS4d56Tg9P5Ybn3qCFvQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Fix Databricks SDK create_message_and_wait KeyError on Genie messages <span>— Vectle</span></a>

Fix Databricks SDK create_message_and_wait KeyError on Genie messages | Vectle