Enqurious logo
TM
Request a Demo
Back to blog
Guides & Tutorials

6 Errors I Hit Connecting Databricks Apps to Genie AI

6 Errors I Hit Connecting Databricks Apps to Genie AI blog cover image
GenAI
Mansi Mutreja

The setup: everything looked perfect

We had just wrapped a successful hackathon. A complete data platform on Databricks:

  • Bronze β†’ Silver β†’ Gold medallion architecture

  • Data quality enforcement

  • Dimensional modelling

  • A Gen AI insights layer

Now came the final challenge: build a Databricks App that connects our Gold layer to Genie AI for natural-language querying.

"How hard could it be?" β€” famous last words.

What followed was six hours of debugging across six different errors, each one teaching me something the documentation didn't make obvious. Here's everything I wish someone had told me before I started.


Error 1: "App crashed" on startup

What I saw in the logs:

AttributeError: st.session_state has no attribute "messages"

What I thought: Simple initialisation bug.

What I did: Fixed the session state initialisation, moved st.set_page_config() to the top of app.py, redeployed.

What happened: Still crashed.

The fix

st.set_page_config() must be the first Streamlit command in the script β€” before any import of session-state-touching modules or any other st.* call. And every key you read from st.session_state must be initialised before first use:

python

import streamlit as st

# This MUST come first
st.set_page_config(page_title="Genie Chat", layout="wide")

# Initialise every session_state key you'll read later
if "messages" not in st.session_state:
    st.session_state.messages = []

Lesson learned: a Streamlit crash on startup is almost always one of these two things. Check both before going deeper.


Error 2: "App not available" after a successful deploy

What I saw:

  • Deployment status: βœ… Successful

  • App URL: ❌ Currently unavailable

What I learned: Deployment success β‰  app accessibility.

The app deploys as a separate identity β€” a service principal with a name like app-xxxxx. That service principal is not you, and it has none of your permissions by default. Until you explicitly grant the service principal access to your Genie space, the app can boot but it can't connect to anything useful.

The fix

In the Genie space β†’ Share β†’ add the app's service principal with CAN RUN.

This is the first of many places where the app's identity needs to be granted access. It will not be the last.


Error 3: MessageStatus.FAILED β€” the one that haunted me

What I saw:

Error: failed to reach COMPLETED, got MessageStatus.FAILED

The cruel twist: Genie worked perfectly in the UI. Same question, same data, same warehouse. But via the App API? Failed every time.

What I tried:

  • Redeployed the app β€” 5 times

  • Cleared browser cache β€” 3 times

  • Rewrote app.py end-to-end β€” 4 versions

  • Re-checked the Genie space configuration β€” multiple times

Nothing worked.

This is where I learned the most important debugging rule of the whole project: the Genie UI and the Genie API use different permission paths. Working in the UI tells you nothing about whether the API will work. They run as different identities, with different access checks.

The fix lived inside Error 4.


Error 4: the permission rabbit hole

After hours of guessing, I finally opened Genie Monitoring β€” and there it was, the real error message that never showed up in my app logs:

PERMISSION_DENIED: Failed to fetch tables for the space.
 β€” No access to table 'insurancesdp.mansigold.claimsanalysis'
 β€” No access to table 'insurancesdp.mansigold.claimsbyregion'
 β€” No access to table 'insurancesdp.mansigold.factclaims'

Wait β€” I had already granted SELECT permissions! Here's what I had done:

sql

GRANT SELECT ON TABLE insurancesdp.mansigold.claimsanalysis
TO `5a59870a-e666-4c16-985f-eaa011cca1b4`;

Here's what I was missing:

sql

GRANT USE CATALOG ON CATALOG insurancesdp
TO `5a59870a-e666-4c16-985f-eaa011cca1b4`;

GRANT USE SCHEMA ON SCHEMA insurancesdp.mansigold
TO `5a59870a-e666-4c16-985f-eaa011cca1b4`;

Unity Catalog is hierarchical. SELECT on a table is not enough β€” the service principal also needs USE CATALOG on the parent catalog and USE SCHEMA on the parent schema. Without those, the table grant is invisible.

The complete permission checklist (save this)

Everything the app service principal needs, in one place:

Level

Permission

Object

Where to grant

Catalog

USE CATALOG

insurancesdp

Catalog β†’ Permissions

Schema

USE SCHEMA

insurancesdp.mansigold

Schema β†’ Permissions

Table

SELECT

claimsanalysis

Table β†’ Permissions

Table

SELECT

claimsbyregion

Table β†’ Permissions

Table

SELECT

factclaims

Table β†’ Permissions

Warehouse

CAN USE

test-sql

SQL Warehouse β†’ Permissions

Genie

CAN RUN

Genie Space

Genie β†’ Share

Miss any one of these and you'll see a different error somewhere. Grant all of them, and you've eliminated 90% of the failure surface.


Error 5: "SQL warehouse stopped"

After fixing the permissions, I tried again. Still failing.

What I saw: The SQL warehouse status was Stopped.

The lesson: You can have every permission in the universe. If the warehouse isn't running, nothing works. Genie needs a warehouse to execute the SQL it generates, and the app needs that warehouse to be CAN USE-able by the service principal and actually running.

The fix

  • Start the warehouse manually before testing

  • Or enable serverless / auto-start so it spins up on demand

  • And confirm the app's service principal has CAN USE on that specific warehouse


Error 6: the silent killer β€” permission propagation delay

What I learned the hard way: Unity Catalog permissions don't apply instantly. They take 5 to 15 minutes to propagate across services.

What I had been doing in a loop:

  1. Grant permissions

  2. Test immediately

  3. Fail

  4. Assume the grant was wrong

  5. Grant again

  6. Test

  7. Fail

  8. Lose another hour

What I should have been doing:

  1. Grant permissions

  2. Wait 10 minutes

  3. Test

  4. Works

This single rule, on its own, would have saved me hours.


The full solution that finally worked

After everything, here's the exact sequence that fixed it:

1. Grant every permission level

sql

-- Catalog level
GRANT USE CATALOG ON CATALOG insurancesdp
TO `5a59870a-e666-4c16-985f-eaa011cca1b4`;

-- Schema level
GRANT USE SCHEMA ON SCHEMA insurancesdp.mansigold
TO `5a59870a-e666-4c16-985f-eaa011cca1b4`;

-- Table level (for each table)
GRANT SELECT ON TABLE insurancesdp.mansigold.claimsanalysis
TO `5a59870a-e666-4c16-985f-eaa011cca1b4`;

GRANT SELECT ON TABLE insurancesdp.mansigold.claimsbyregion
TO `5a59870a-e666-4c16-985f-eaa011cca1b4`;

GRANT SELECT ON TABLE insurancesdp.mansigold.factclaims
TO `5a59870a-e666-4c16-985f-eaa011cca1b4`;

Then via the UI:

  • SQL Warehouses β†’ test-sql β†’ Permissions β†’ Add app β†’ Can Use

  • Genie β†’ Space β†’ Share β†’ Add app β†’ Can Run

2. Wait 10 to 15 minutes

Seriously. Wait. Don't test immediately.

3. Use this app.yaml

yaml

command: ["streamlit", "run", "app.py"]
env:
  - name: GENIE_SPACE_ID
    valueFrom: genie-space
runtime: python-3.10

The command matters. ["streamlit", "run", "app.py"] is correct. ["python", "app.py"] will boot a Python process that immediately exits because Streamlit was never started.

4. Clear everything and test

  • Clear the chat in the app

  • Hard refresh the browser (Cmd + Shift + R / Ctrl + Shift + R)

  • Try a simple query first ("How many rows are in the claims table?") before complex ones


7 things I wish someone had told me on day one

  1. Genie UI working β‰  Genie API working. They use different permission paths. Test both.

  2. USE CATALOG is mandatory. You cannot read a table, even with SELECT, without it.

  3. Permissions take time. Don't test for 10 minutes after granting.

  4. Check Genie Monitoring. This is where the real error messages live β€” not in your app logs.

  5. The app service principal is not you. It's a separate identity that needs its own permissions everywhere.

  6. The warehouse must be running. Sounds obvious. Easy to miss.

  7. app.yaml command matters. Use ["streamlit", "run", "app.py"], not ["python", "app.py"].


Quick-reference: error to fix

Problem

Most likely cause

Where to look

App crashes on startup

st.set_page_config() not first, or session state read before init

App logs

App not available after successful deploy

Service principal missing Genie space access

Genie β†’ Share

MessageStatus.FAILED

Missing USE CATALOG / USE SCHEMA / table SELECT

Genie Monitoring

Genie works in UI but not via API

API uses service principal, needs its own grants

Genie Monitoring + Unity Catalog

Warehouse errors

Warehouse stopped, or no CAN USE

SQL Warehouse β†’ Permissions

app.yaml errors

Wrong command syntax

App config


The real talk

Building on Databricks is powerful. The platform is genuinely production-grade once you get there. But the permission model is layered, and the error messages don't always tell you the real problem.

MessageStatus.FAILED alone could mean any of:

  • Missing table permissions

  • Missing catalog or schema permissions

  • A stopped warehouse

  • A misconfigured Genie space

  • Permission propagation delay

  • The app service principal not added to the Genie space

Good luck figuring out which one β€” unless you check Genie Monitoring first.

Once it works, though? It's magic. Natural-language queries running on a Gold-layer dimensional model, with Gen AI insights on top, all behind a clean Streamlit app. That's the payoff.

The pain is real. The payoff is worth it.


FAQs

Why does my Databricks App show "Currently unavailable" after a successful deploy? Deployment success means the app started; it does not mean the app's service principal can reach the resources it needs. The most common cause is missing access to the Genie space. Grant the app's service principal CAN RUN on the Genie space via Genie β†’ Share.

Why does Genie work in the UI but fail with MessageStatus.FAILED from my app? The Genie UI runs as you. The Genie API, when called from a Databricks App, runs as the app's service principal. They have different permissions. Open Genie Monitoring to see the real error β€” it's almost always a Unity Catalog permission the service principal is missing.

What permissions does a Databricks App service principal need to query Gold layer tables through Genie? Six things, in order: USE CATALOG on the catalog, USE SCHEMA on the schema, SELECT on each table, CAN USE on the SQL warehouse, and CAN RUN on the Genie space. Miss any one and you'll see a different error.

Why isn't my GRANT SELECT working on the table? Unity Catalog is hierarchical. SELECT on a table requires USE CATALOG on the parent catalog and USE SCHEMA on the parent schema. Without those, the table grant is effectively invisible.

How long do Unity Catalog permission grants take to apply? Typically 5 to 15 minutes. Test only after waiting. Granting the same permission twice does not speed it up.

Should my app.yaml use python or streamlit? For a Streamlit app, use command: ["streamlit", "run", "app.py"]. Using ["python", "app.py"] will start a Python process that exits immediately because the Streamlit server is never launched.


Resources that would have saved me hours


Have you hit similar permission nightmares on Databricks? Drop a note β€” I'm building a running list of edge cases that aren't obvious from the docs.

Built with Databricks, Streamlit, Genie AI, and a lot of coffee.

Ready to Experience the Future of Data?

Discover how Enqurious helps deliver an end-to-end learning experience
Curious how we're reshaping the future of data? Watch our story unfold
Get Free Snowpro Core Certification Skill Path

You Might Also Like

What Happens When Claude Meets Databricks? blog cover image
Guides & Tutorials
June 5, 2026
What Happens When Claude Meets Databricks?

How a data engineering team replaced manual pipeline work with natural language prompts, using Claude Code and the Databricks AI Dev Kit.

Sayli Sr. Data Engineer
Where Did My Claude Code Session Go? How to Find Any Lost Session blog cover image
Guides & Tutorials
June 2, 2026
Where Did My Claude Code Session Go? How to Find Any Lost Session

Your Claude Code session isn't lost. It's on disk, in a folder /resume isn't scanning. Here's how to find any session in 30 seconds, with the exact commands.

Mansi AI & ML Engineer
What is Scenario Based Learning for Data Teams? blog cover image
Guides & Tutorials
May 15, 2026
What is Scenario Based Learning for Data Teams?

Scenario based learning replaces tutorials with realistic operational scenarios where engineers develop the hands on judgment classroom instruction cannot produce. How it works and why it matters.

Mandar Sr. Data Analyst
Data Engineering Roadmap 2026: What Companies Actually Hire blog cover image
Guides & Tutorials
May 5, 2026
Data Engineering Roadmap 2026: What Companies Actually Hire

The 2026 data engineering roadmap. SQL, Python, cloud, Airflow, dbt, streaming. What companies actually hire for and how to build a portfolio that gets shortlisted.

Mandar Sr. Data Analyst
Medallion Architecture: Why Most Data Pipelines Break Without It blog cover image
Guides & Tutorials
April 30, 2026
Medallion Architecture: Why Most Data Pipelines Break Without It

Medallion Architecture splits your data pipeline into Bronze, Silver, and Gold layers so a small business change never forces a full rebuild. Here's why it works.

Divyanshi Data Engineer
An Advanced Git Tutorial: Lessons from a Real-World Versioning Crisis blog cover image
Guides & Tutorials
March 7, 2026
An Advanced Git Tutorial: Lessons from a Real-World Versioning Crisis

I was working on a large content repository on Windows, and I needed to version some new work β€” campaign assets, workshop content, LinkedIn job descriptions, and some file deletions. Simple enough, right? What followed was a two-day journey through some of Git's more obscure corners.

Amit Co-founder & CEO
Data Quality Explained: Challenges, Best Practices, and Complete 2026 Guide blog cover image
Guides & Tutorials
January 23, 2026
Data Quality Explained: Challenges, Best Practices, and Complete 2026 Guide

A complete beginner’s guide to data quality, covering key challenges, real-world examples, and best practices for building trustworthy data.

Divyanshi Data Engineer
Data Lakehouse Demystified: Unlocking Databricks’ Hidden Powers in 2025 blog cover image
Guides & Tutorials
December 29, 2025
Data Lakehouse Demystified: Unlocking Databricks’ Hidden Powers in 2025

Explore the power of Databricks Lakehouse, Delta tables, and modern data engineering practices to build reliable, scalable, and high-quality data pipelines."

Divyanshi Data Engineer
Data Doesn’t Wait Anymore: A Guide to Streaming with Azure Databricks blog cover image
Guides & Tutorials
December 15, 2025
Data Doesn’t Wait Anymore: A Guide to Streaming with Azure Databricks

Data doesn’t wait - and neither should your insights. This blog breaks down streaming vs batch processing and shows, step by step, how to process real-time data using Azure Databricks.

Divyanshi Data Engineer
Unity Catalog Just Leveled Up: Meet your Data’s New Bodyguards blog cover image
Guides & Tutorials
December 8, 2025
Unity Catalog Just Leveled Up: Meet your Data’s New Bodyguards

This blog talks about Databricks’ Unity Catalog upgrades -like Governed Tags, Automated Data Classification, and ABAC which make data governance smarter, faster, and more automated.

Divyanshi Data Engineer
"Yeh Dosti" of AI: Claude & Nano Banana as Jai & Veeru! blog cover image
Guides & Tutorials
December 6, 2025
"Yeh Dosti" of AI: Claude & Nano Banana as Jai & Veeru!

Tired of boring images? Meet the 'Jai & Veeru' of AI! See how combining Claude and Nano Banana Pro creates mind-blowing results for comics, diagrams, and more.

Burhanuddin DevOps Engineer
The Day I Discovered Databricks Connect  blog cover image
Guides & Tutorials
December 1, 2025
The Day I Discovered Databricks Connect

This blog walks you through how Databricks Connect completely transforms PySpark development workflow by letting us run Databricks-backed Spark code directly from your local IDE. From setup to debugging to best practices this Blog covers it all.

Divyanshi Data Engineer
Building Bronze Layer: Using COPY INTO in Databricks blog cover image
Guides & Tutorials
September 12, 2025
Building Bronze Layer: Using COPY INTO in Databricks

Master the bronze layer foundation of medallion architecture with COPY INTO - the command that handles incremental ingestion and schema evolution automatically. No more duplicate data, no more broken pipelines when new columns arrive. Your complete guide to production-ready raw data ingestion

Sayli Sr. Data Engineer
Understanding the Power Law Distribution blog cover image
Guides & Tutorials
January 3, 2025
Understanding the Power Law Distribution

This blog talks about the Power Law statistical distribution and how it explains content virality

Amit Co-founder & CEO
An L&D Strategy to achieve 100% Certification clearance blog cover image
Guides & Tutorials
December 6, 2023
An L&D Strategy to achieve 100% Certification clearance

An account of experience gained by Enqurious team as a result of guiding our key clients in achieving a 100% success rate at certifications

Amit Co-founder & CEO