Introduction
The TestUC2001 – Metastore Not Found error in Databricks Unity Catalog typically occurs when a metastore has not been assigned to the workspace or the existing metastore configuration is invalid or corrupted. Unity Catalog requires a configured and assigned metastore to manage catalogs, schemas, and tables. Without a valid metastore, catalog-related commands like SHOW CATALOGS
or USE CATALOG
will fail.
🚨 Common symptoms of TestUC2001:
- Error: “TestUC2001 – Metastore not found for this workspace.”
SHOW METASTORES;
returns an empty result.- Cannot create catalogs or manage tables in Unity Catalog.
- Jobs and notebooks fail when querying Unity Catalog tables.
Common Causes and Fixes for TestUC2001
1. No Metastore Has Been Configured for the Workspace
Symptoms:
SHOW METASTORES;
returns no results.- Error: “No metastore is configured for this workspace.”
Causes:
- Metastore has not been created for Unity Catalog.
- The workspace is not linked to any existing metastore.
Fix:
✅ Check if a metastore exists:
SHOW METASTORES;
✅ If no metastore exists, create one:
databricks unity-catalog metastores create --region <region> --s3-bucket <s3-bucket-name>
✅ Assign the newly created metastore to your workspace:
databricks unity-catalog metastores assign --metastore-id <metastore-id> --workspace-id <workspace-id>
✅ Verify the assignment using:
SHOW METASTORES;
2. Incorrect Metastore Assignment or Workspace Configuration
Symptoms:
- Metastore exists but is not properly assigned to the workspace.
- Metastore ID mismatch when querying Unity Catalog.
SHOW CATALOGS;
fails with TestUC2001 error.
Causes:
- The metastore assignment was not completed successfully.
- Workspace configuration was not refreshed after metastore creation.
Fix:
✅ Reassign the metastore to your workspace:
databricks unity-catalog metastores assign --metastore-id <metastore-id> --workspace-id <workspace-id>
✅ Restart the Databricks workspace to apply changes.
✅ Ensure that the metastore assignment is successful:
SHOW METASTORES;
3. Missing Permissions to Access the Metastore
Symptoms:
- Error: “Permission denied while accessing the metastore.”
- Users cannot list catalogs, schemas, or tables.
Causes:
- User or service principal lacks access permissions to the Unity Catalog metastore.
- The workspace admin has not granted permissions to relevant users or groups.
Fix:
✅ Check the current permissions on the metastore:
databricks unity-catalog permissions get --metastore-id <metastore-id>
✅ Grant access to the required users or groups:
databricks unity-catalog permissions update --metastore-id <metastore-id> --principal user@example.com --permission-level OWNER
✅ Ensure service principals running jobs have the correct roles.
4. Corrupt or Deleted Metastore
Symptoms:
- Metastore existed earlier but is no longer accessible.
- Metastore metadata is corrupted or partially deleted.
- SQL commands fail with internal errors.
Causes:
- Misconfigured cloud storage for the metastore (S3, ADLS, or GCS).
- Accidental deletion of the metastore configuration.
Fix:
✅ Check metastore configuration and storage:
aws s3 ls s3://<metastore-storage-bucket>/_delta_log/
✅ If the metastore is corrupted, recreate it and assign it again:
databricks unity-catalog metastores create --region <region> --s3-bucket <s3-bucket-name>
✅ Restore the metastore from backups if available.
Step-by-Step Troubleshooting Guide
1. Verify If a Metastore Exists
SHOW METASTORES;
2. Check Metastore Assignment to the Workspace
databricks unity-catalog metastores get-assignment --workspace-id <workspace-id>
3. Ensure Correct Permissions
databricks unity-catalog permissions get --metastore-id <metastore-id>
4. Validate Cloud Storage for the Metastore
aws s3 ls s3://<bucket-name>/
Best Practices to Avoid TestUC2001 – Metastore Not Found Error
✅ Always Create and Assign a Metastore for Unity Catalog
- Ensure a valid Unity Catalog metastore is created and linked to your workspace.
✅ Use Proper IAM Roles and Permissions
- Grant workspace admins and relevant users access to the Unity Catalog metastore.
✅ Monitor Cloud Storage for Corruption or Deletion
- Regularly backup the metastore configuration and logs.
✅ Avoid Using Legacy Hive Metastore with Unity Catalog
- Migrate existing Hive Metastore tables to Unity Catalog.
Conclusion
The TestUC2001 – Metastore Not Found error occurs when Unity Catalog is not properly configured or assigned to a Databricks workspace. By creating and assigning a metastore, verifying permissions, and ensuring cloud storage configuration, you can resolve this error and enable seamless Unity Catalog operations.