

# Troubleshooting data lineage

The following sections describe common data lineage issues and how to resolve them.

## Lineage doesn't appear for a job
<a name="catalog-lineage-troubleshooting-no-lineage"></a>

Check the following:

1. **Release.** The job runs on emr-spark-8.2.0 or later, or AWS Glue 6.1 or later.

1. **The job writes data.** Queries that only read data don't produce lineage.

1. **Permission.** The role that sends events has `glue:PostLineageEvent`. See [Permissions to send lineage](catalog-lineage-permissions.md#permissions-to-send-lineage) for which role that is. Look for a warning in the Spark driver log.

1. **Network.** Jobs in private subnets have an interface VPC endpoint for AWS Glue, or another route to it. If the endpoint has a policy, it allows `glue:PostLineageEvent`.

1. **Opt-out.** The job doesn't set `spark.openlineage.disabled=true`, and no IAM policy or service control policy (SCP) denies `glue:PostLineageEvent`.

1. **Overridden properties.** The job doesn't override `spark.openlineage.transport.type` or remove the listener from `spark.extraListeners`.

1. **Time.** Lineage is processed asynchronously. Wait a few minutes after the job completes.

## The graph shows an S3 path instead of a table
<a name="catalog-lineage-troubleshooting-s3-path"></a>

The job wrote by path, not through the Data Catalog. Write to the table by name, for example `INSERT INTO sales_db.orders`, so the output resolves to the Amazon Resource Name (ARN) of the AWS Glue table.

## The same table appears as two nodes
<a name="catalog-lineage-troubleshooting-two-nodes"></a>

The producers used different identifiers for the same dataset. Use the AWS Glue naming for Data Catalog tables: namespace `arn:aws:glue:<region>:<account-id>` and name `table/<database>/<table>`.

## Duplicate lineage after moving from Amazon EMR 7.x
<a name="catalog-lineage-troubleshooting-duplicate-emr"></a>

The job still lists the Amazon DataZone lineage JAR or properties. Remove them. See [Lineage for Amazon EMR](catalog-lineage-emr.md).

## AccessDeniedException from GetLineageNode
<a name="catalog-lineage-troubleshooting-accessdenied"></a>

The principal needs `glue:GetLineageNode`. Data Catalog grants and Lake Formation permissions don't give access to lineage.

## InvalidInputException from PostLineageEvent
<a name="catalog-lineage-troubleshooting-invalidinput"></a>

The event isn't a valid OpenLineage RunEvent. Check that it has `eventType`, `eventTime`, `run.runId`, `job.namespace`, `job.name`, and `producer`, and that the JSON is encoded as UTF-8 bytes (or base64 in the HTTP API).

## The lineage system table is empty
<a name="catalog-lineage-troubleshooting-empty-table"></a>
+ The system table records events only from the time you turned it on.
+ Check the setting with `aws glue get-data-catalog-export-configuration`.
+ Wait about 5 minutes after the job completes.

## Queries on the lineage system table fail
<a name="catalog-lineage-troubleshooting-query-fail"></a>
+ The principal needs Lake Formation `SELECT` on the table and `s3tables:GetTableData`.
+ Integration with AWS analytics services is turned on for the `aws-catalog` table bucket.
+ If the table uses a customer managed key, the principal has `kms:Decrypt`.

## Snowflake or Databricks lineage is missing
<a name="catalog-lineage-troubleshooting-snowflake-databricks"></a>
+ Check the crawler run status and logs.
+ Check that the Snowflake role or Databricks service principal can read the history or lineage system tables.
+ The first run collects only the last 7 days.