You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "omkar-foss (via GitHub)" <gi...@apache.org> on 2026/04/17 15:52:16 UTC

[PR] Add error codes mapping with doc pages generation and static check [airflow]

omkar-foss opened a new pull request, #65423:
URL: https://github.com/apache/airflow/pull/65423

   Related: #43171
   
   This adds AirflowEnumeratedException providing a way for devs to specify error code (AERR) while raising exceptions. These AERRs are mapped in yaml providing info about the error to users via docs, as a new doc page is generated for each error code in the yaml.
   
   This also adds a static check that validates raises for AirflowEnumeratedException and all its subclasses. Supporting tests also added for this static check.
   
   Entire story can be thought of as follows:
   - airflow dev identifies an error case and raises a new enumerated exception in code with new error code (say AERRNEW01)
   - dev then adds AERRNEW01 to error mapping yml with required info
   - dev runs breeze build-docs that generates a new page for AERRNEW01
   - in case dev misses adding AERRNEW01 to error mapping yml or doesnt specify error_code in raise then static check will catch it
   
    <!-- SPDX-License-Identifier: Apache-2.0
         https://www.apache.org/licenses/LICENSE-2.0 -->
   
   <!--
   Thank you for contributing!
   
   Please provide above a brief description of the changes made in this pull request.
   Write a good git commit message following this guide: http://chris.beams.io/posts/git-commit/
   
   Please make sure that your code changes are covered with tests.
   And in case of new features or big changes remember to adjust the documentation.
   
   Feel free to ping (in general) for the review if you do not see reaction for a few days
   (72 Hours is the minimum reaction time you can expect from volunteers) - we sometimes miss notifications.
   
   In case of an existing issue, reference it using one of the following:
   
   * closes: #ISSUE
   * related: #ISSUE
   -->
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, please
   change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
   -->
   
   No
   
   <!--
   Generated-by: [Tool Name] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   -->
   
   ---
   
   * Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3161901488


##########
airflow-core/src/airflow/config_templates/error_mapping.yml:
##########


Review Comment:
   I've moved the error mapping yml to airflow-core/docs as it seems an appropriate location, but let me know if otherwise.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3167265908


##########
airflow-core/docs/error_mapping.yml:
##########
@@ -0,0 +1,160 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+
+error_guide:
+  description: Quick debug guide for common errors while using Airflow.
+  error_codes:
+    # AERR001: Generic error, should only be raised as a catch-all error, if all else fails.

Review Comment:
   AirflowException should no longer be used, per the previous discussion on the dev list.



##########
airflow-core/docs/error_mapping.yml:
##########
@@ -0,0 +1,160 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+
+error_guide:
+  description: Quick debug guide for common errors while using Airflow.
+  error_codes:
+    # AERR001: Generic error, should only be raised as a catch-all error, if all else fails.

Review Comment:
   old ones might or might not be removed, but no new ones should be added



##########
airflow-core/src/airflow/models/connection.py:
##########
@@ -527,7 +527,9 @@ def get_connection_from_secrets(cls, conn_id: str, team_name: str | None = None)
                 return conn
             except AirflowRuntimeError as e:
                 if e.error.error == ErrorType.CONNECTION_NOT_FOUND:
-                    raise AirflowNotFoundException(f"The conn_id `{conn_id}` isn't defined") from None
+                    raise AirflowNotFoundException(
+                        f"The conn_id `{conn_id}` isn't defined", error_code="AERR002"

Review Comment:
   Is it possible to embed the error_code in AirflowNotFoundException instead? otherwise, it will be missed in the future



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3213676282


##########
task-sdk/src/airflow/sdk/exceptions.py:
##########
@@ -33,6 +33,26 @@
     from airflow.sdk.execution_time.comms import ErrorResponse
 
 
+class AirflowErrorCodeMixin:

Review Comment:
   Done, added a new shared library shared/exceptions.



##########
task-sdk/src/airflow/sdk/exceptions.py:
##########
@@ -33,6 +33,26 @@
     from airflow.sdk.execution_time.comms import ErrorResponse
 
 
+class AirflowErrorCodeMixin:
+    """Mixin class providing ability to pass error_code to an exception."""
+
+    def __init__(self, *args, error_code=None, **kwargs):
+        self.error_code = error_code
+        super().__init__(*args, **kwargs)
+
+    def __str__(self):
+        base = super().__str__()
+        if self.error_code is None:
+            return base
+        error_code_str = f"[airflow error code={self.error_code}]"
+        return f"{base} {error_code_str}" if base else error_code_str
+
+    def __repr__(self):
+        if self.error_code is None:
+            return super().__repr__()
+        return f"{self.__class__.__name__}(airflow error code={self.error_code}, args={self.args})"

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #65423:
URL: https://github.com/apache/airflow/pull/65423#issuecomment-4416074814

   tests are badly failing.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3213687056


##########
scripts/tests/ci/prek/test_check_airflow_error_codes.py:
##########
@@ -0,0 +1,91 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+from unittest import mock
+
+from check_airflow_error_codes import check_for_errors
+from ci.prek.common_prek_utils import AIRFLOW_CORE_SOURCES_PATH, temporary_python_file
+
+
+class TestCheckAirflowErrorCodes:
+    def setup_method(self):
+        self.exc_def = """
+class ErrorCodesTestException(Exception):
+    pass
+
+raise ErrorCodesTestException"""
+
+    @mock.patch("check_airflow_error_codes.load_error_mapping")
+    def test_raise_with_unmapped_error_code(self, mock_load_error_mapping):
+        mock_load_error_mapping.return_value = {"AERRTEST": "ErrorCodesTestException"}
+
+        nonexistent_error_code = "AERRNOTINMAPPINGFILE"
+        contents = f"{self.exc_def}('this is a test', error_code='{nonexistent_error_code}')"
+        with temporary_python_file(AIRFLOW_CORE_SOURCES_PATH, contents) as f:
+            errors = check_for_errors(paths=[f.name])
+
+        assert len(errors) == 1
+        error_substr = f"'{nonexistent_error_code}' not found in error mapping file"
+        assert error_substr in errors[0]
+
+    @mock.patch("check_airflow_error_codes.load_error_mapping")
+    def test_raise_with_mapped_error_code(self, mock_load_error_mapping):
+        mock_load_error_mapping.return_value = {"AERRTEST": "ErrorCodesTestException"}
+        mapped_error_code = "AERRTEST"
+
+        contents = f"{self.exc_def}('this is a test', error_code='{mapped_error_code}')"
+        with temporary_python_file(AIRFLOW_CORE_SOURCES_PATH, contents) as f:

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3213684842


##########
devel-common/src/sphinx_exts/error_guide_generator.py:
##########
@@ -0,0 +1,133 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+import os
+from pathlib import Path
+
+import yaml
+
+AIRFLOW_ROOT_PATH = Path(os.path.abspath(__file__)).parents[3]
+GENERATED_PATH = AIRFLOW_ROOT_PATH / "airflow-core" / "docs" / "contributor" / "error_codes"
+GENERATED_PATH.mkdir(parents=True, exist_ok=True)

Review Comment:
   error_mapping.yml exists or not will be checked in the static check. And index.rst will be created irrespective of whether error_mapping.yml has any error code. So all cases are covered here, please have a look at updated code. Thanks.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3213674551


##########
devel-common/src/sphinx_exts/error_guide_generator.py:
##########
@@ -0,0 +1,133 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+import os
+from pathlib import Path
+
+import yaml
+
+AIRFLOW_ROOT_PATH = Path(os.path.abspath(__file__)).parents[3]
+GENERATED_PATH = AIRFLOW_ROOT_PATH / "airflow-core" / "docs" / "contributor" / "error_codes"
+GENERATED_PATH.mkdir(parents=True, exist_ok=True)

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3176651504


##########
airflow-core/.pre-commit-config.yaml:
##########
@@ -22,6 +22,20 @@ default_language_version:
   node: 22.19.0
   golang: 1.24.0
 repos:
+  - repo: local
+    hooks:
+      - id: check-error-code-in-exceptions
+        name: Check error_code usage in exceptions
+        entry: ../scripts/ci/prek/check_airflow_error_codes.py
+        language: python
+        files: >
+          (?x)
+          ^src/airflow/.*\.py$|

Review Comment:
   This regex doesn't do what it looks like.
   
   This hook lives in `airflow-core/.pre-commit-config.yaml`, which prek runs from the `airflow-core/` directory. File paths in the `files:` regex are matched relative to that directory, so:
   
   - `^src/airflow/.*\.py$` matches `airflow-core/src/airflow/...` files ✅
   - `^providers/.*\.py$` ❌ — `providers/` is a sibling of `airflow-core/`, not underneath it; this branch never matches anything
   - `^task-sdk/.*\.py$` ❌ — same issue
   
   So the static check **only validates raises in `airflow-core/src/airflow/`**. Provider raises and task-sdk raises sail right past it, even though the YAML mapping (and the test file `test_check_airflow_error_codes.py`) clearly intend the check to be repo-wide.
   
   Two fixes:
   
   1. Move the hook to the **top-level** `.pre-commit-config.yaml` (where paths are repo-rooted) and keep the current regex roughly as-is — that's where you want a check that spans `airflow-core/`, `providers/`, and `task-sdk/`.
   2. Or, if the intent really is "airflow-core only for now", drop the `providers/` and `task-sdk/` branches and put a `# TODO(...)` referencing a follow-up tracking issue per [AGENTS.md "Tracking issues for deferred work"](https://github.com/apache/airflow/blob/main/AGENTS.md).
   
   CI passing here is misleading because the hook silently no-ops for the intended scope.



##########
task-sdk/src/airflow/sdk/exceptions.py:
##########
@@ -33,6 +33,26 @@
     from airflow.sdk.execution_time.comms import ErrorResponse
 
 
+class AirflowErrorCodeMixin:
+    """Mixin class providing ability to pass error_code to an exception."""
+
+    def __init__(self, *args, error_code=None, **kwargs):
+        self.error_code = error_code
+        super().__init__(*args, **kwargs)
+
+    def __str__(self):
+        base = super().__str__()
+        if self.error_code is None:
+            return base
+        error_code_str = f"[airflow error code={self.error_code}]"

Review Comment:
   The string format `[airflow error code=AERR003]` is observable in user logs, stack traces, and any tooling that pattern-matches on exception messages — so it's effectively a public-API choice. Two suggestions:
   
   1. **Drop the `key=value` form**: convention in most projects is a bare bracketed code (`[AERR003]`) or parenthesized (`(AERR003)`). The current form repeats "airflow" in every message even though the prefix `AERR` already encodes that, and the `=` reads like a kwarg leakage.
   2. **Prefix, not suffix**: `[AERR003] schedule interval must be positive…` reads more naturally and is easier to grep for than a trailing tag. Compare to how `errno` works in libc-style messages.
   
   Whatever format wins, please also add a `airflow-core/newsfragments/65423.significant.rst` entry — the change in exception message format is observable behavior for anyone scraping logs.



##########
task-sdk/src/airflow/sdk/exceptions.py:
##########
@@ -33,6 +33,26 @@
     from airflow.sdk.execution_time.comms import ErrorResponse
 
 
+class AirflowErrorCodeMixin:

Review Comment:
   This mixin is duplicated **verbatim** in `airflow-core/src/airflow/exceptions.py` (lines 46-63), inside the `except ModuleNotFoundError` fallback branch. If the two implementations ever drift, behavior of `AirflowNotFoundException` (etc.) will silently differ between the SDK-installed and `_AIRFLOW__AS_LIBRARY` modes.
   
   The right home for this is `shared/` — see `shared/providers_discovery/`, `shared/logging/`, etc. for the existing pattern. Move `AirflowErrorCodeMixin` (and the `error_code` field on it) into a small shared distribution like `shared/exceptions/`, and import it from both `airflow-core/src/airflow/exceptions.py` and `task-sdk/src/airflow/sdk/exceptions.py`. That's also what AGENTS.md "Shared libraries" guidance points at.



##########
scripts/ci/prek/common_prek_utils.py:
##########
@@ -79,6 +79,50 @@ def temporary_tsc_project(
     yield temp_tsconfig_path
 
 
+def is_valid_python(contents: str) -> bool:
+    """
+    Checks if contents is valid python code or not.
+    args:
+        contents (str): Code contents.
+    returns: True if valid python code, False otherwise.
+    """
+    try:
+        compile(contents, "<string>", "exec")
+        return True
+    except SyntaxError:
+        return False
+
+
+@contextmanager
+def temporary_python_file(dir_path: Path, contents: str) -> Generator[_TemporaryFileWrapper, None, None]:

Review Comment:
   Two concerns about adding this to the shared `common_prek_utils.py`:
   
   1. **YAGNI** — only one caller exists right now (`test_check_airflow_error_codes.py`). Per AGENTS.md "Don't add features… beyond what the task requires", inline this in the test file (or in a nearby `conftest.py`) until a second caller appears. Keeping `common_prek_utils.py` lean for things actually shared between hooks keeps the module's blast radius small.
   2. **Debug prints in a shared utility** (line 115-119) — `console.print(...)` of the *entire python source* on every invocation is going to spam test output noisily. If you keep the helper, drop the print or gate it on a `verbose=False` parameter that defaults off.



##########
task-sdk/src/airflow/sdk/exceptions.py:
##########
@@ -33,6 +33,26 @@
     from airflow.sdk.execution_time.comms import ErrorResponse
 
 
+class AirflowErrorCodeMixin:
+    """Mixin class providing ability to pass error_code to an exception."""
+
+    def __init__(self, *args, error_code=None, **kwargs):
+        self.error_code = error_code
+        super().__init__(*args, **kwargs)
+
+    def __str__(self):
+        base = super().__str__()
+        if self.error_code is None:
+            return base
+        error_code_str = f"[airflow error code={self.error_code}]"
+        return f"{base} {error_code_str}" if base else error_code_str
+
+    def __repr__(self):
+        if self.error_code is None:
+            return super().__repr__()
+        return f"{self.__class__.__name__}(airflow error code={self.error_code}, args={self.args})"

Review Comment:
   This `__repr__` doesn't round-trip. Conventional `repr` for an exception is `AirflowNotFoundException('msg')` — eval-able when the args themselves are literals. The new form `AirflowNotFoundException(airflow error code=AERR001, args=('msg',))` is neither:
   - not eval-able (`airflow error code` is not a Python identifier);
   - the `args=...` framing duplicates information already in the error code prefix.
   
   If you need a repr that includes the code, mirror the `__init__` signature:
   
   ```python
   def __repr__(self):
       args_repr = ", ".join(repr(a) for a in self.args)
       if self.error_code is None:
           return f"{type(self).__name__}({args_repr})"
       return f"{type(self).__name__}({args_repr}, error_code={self.error_code!r})"
   ```
   
   That's eval-friendly and matches how the exception was actually constructed.



##########
devel-common/src/sphinx_exts/error_guide_generator.py:
##########
@@ -0,0 +1,133 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+import os
+from pathlib import Path
+
+import yaml
+
+AIRFLOW_ROOT_PATH = Path(os.path.abspath(__file__)).parents[3]
+GENERATED_PATH = AIRFLOW_ROOT_PATH / "airflow-core" / "docs" / "contributor" / "error_codes"
+GENERATED_PATH.mkdir(parents=True, exist_ok=True)

Review Comment:
   `GENERATED_PATH.mkdir(parents=True, exist_ok=True)` runs at **module import time**. Any code that imports this extension (Sphinx itself, but also any test that imports the module) silently mutates the filesystem at `airflow-core/docs/contributor/error_codes/`. That's a side effect Pythonic style says doesn't belong at module top.
   
   Move it inside `generate_error_docs(app)`, right before you start writing files. That way:
   - importing the module is pure;
   - the directory only gets created during an actual Sphinx build;
   - the path is computed once from a real `app.confdir` rather than a `__file__`-derived guess (Sphinx exts commonly use `app.confdir` / `app.srcdir` for this).
   
   Two related items while you're in here:
   - The generated `airflow-core/docs/contributor/error_codes/` directory is **not in any `.gitignore`** I could find. After @ashb's earlier point about not committing the generated `AERR001.rst`, the next dev who runs `breeze build-docs` locally will see a tree of untracked files in their `git status`. Add a `.gitignore` (or `airflow-core/docs/.gitignore` carve-out) covering this directory.
   - `index.rst` only gets regenerated if `error_mapping.yml` exists. If someone moves/renames the YAML, the build fails with a `toctree` reference to a missing file — which is a confusing error. Consider making `airflow-core/docs/index.rst`'s reference to `contributor/error_codes/index` conditional on the extension having generated something, or fail fast with a clearer message.



##########
scripts/tests/ci/prek/test_check_airflow_error_codes.py:
##########
@@ -0,0 +1,91 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+from unittest import mock
+
+from check_airflow_error_codes import check_for_errors
+from ci.prek.common_prek_utils import AIRFLOW_CORE_SOURCES_PATH, temporary_python_file
+
+
+class TestCheckAirflowErrorCodes:
+    def setup_method(self):
+        self.exc_def = """
+class ErrorCodesTestException(Exception):
+    pass
+
+raise ErrorCodesTestException"""
+
+    @mock.patch("check_airflow_error_codes.load_error_mapping")
+    def test_raise_with_unmapped_error_code(self, mock_load_error_mapping):
+        mock_load_error_mapping.return_value = {"AERRTEST": "ErrorCodesTestException"}
+
+        nonexistent_error_code = "AERRNOTINMAPPINGFILE"
+        contents = f"{self.exc_def}('this is a test', error_code='{nonexistent_error_code}')"
+        with temporary_python_file(AIRFLOW_CORE_SOURCES_PATH, contents) as f:
+            errors = check_for_errors(paths=[f.name])
+
+        assert len(errors) == 1
+        error_substr = f"'{nonexistent_error_code}' not found in error mapping file"
+        assert error_substr in errors[0]
+
+    @mock.patch("check_airflow_error_codes.load_error_mapping")
+    def test_raise_with_mapped_error_code(self, mock_load_error_mapping):
+        mock_load_error_mapping.return_value = {"AERRTEST": "ErrorCodesTestException"}
+        mapped_error_code = "AERRTEST"
+
+        contents = f"{self.exc_def}('this is a test', error_code='{mapped_error_code}')"
+        with temporary_python_file(AIRFLOW_CORE_SOURCES_PATH, contents) as f:

Review Comment:
   These tests write temp files into `AIRFLOW_CORE_SOURCES_PATH` (the actual source tree at `airflow-core/src/airflow/`). Two issues:
   
   1. **Source-tree pollution.** A test crash or KeyboardInterrupt before the `delete=True` runs leaves stale `testing_temp_*.py` files inside `airflow-core/src/airflow/` — they then get picked up by other tools that walk the source tree (mypy, ruff, the very prek hook this PR is adding, etc.).
   2. **It's unnecessary.** `validate_file()` opens by path and parses with `ast.parse` — it doesn't care where the file lives. Use the standard pytest `tmp_path` fixture and the tests work identically without ever touching the source tree.
   
   Suggested:
   
   ```python
   def test_raise_with_mapped_error_code(self, tmp_path, mock_load_error_mapping):
       mock_load_error_mapping.return_value = {"AERRTEST": "ErrorCodesTestException"}
       f = tmp_path / "fake_module.py"
       f.write_text(f"{self.exc_def}('this is a test', error_code='AERRTEST')")
       errors = check_for_errors(paths=[str(f)])
       assert errors == []
   ```
   
   That also removes the dependency on `temporary_python_file` from the test suite, which makes the YAGNI-on-the-helper point in the other comment easier to act on.



##########
airflow-core/docs/error_mapping.yml:
##########
@@ -0,0 +1,149 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+
+error_guide:
+  description: Quick debug guide for common errors while using Airflow.
+  error_codes:
+    # Specify error codes below for exception classes as required.
+    # Exception class can have multiple error codes representing its respective error states.
+    # e.g. AirflowNotFoundException can have AERR001, AERR002, etc representing different not found cases.
+    - error_code: AERR001
+      exception_type: AirflowNotFoundException
+      user_facing_error_message: TaskSDK connection not found for requested connection ID
+      description: This error occurs when Airflow is unable to locate a connection
+        with given connection id in any configured secrets backend or metadata
+        store. It attempted to retrieve the connection via the Task SDK, but no
+        matching entry was found.
+      first_steps: Verify that the connection ID is correctly configured in Airflow.
+        Check your secrets backend, environment variables, or Airflow UI to
+        ensure the connection exists and is accessible to the current task.
+        Confirm there are no typos in the conn_id. If using a secrets backend,
+        ensure it is properly configured and reachable.
+      documentation: >
+        https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#using-connections
+
+    - error_code: AERR002
+      exception_type: AirflowNotFoundException
+      user_facing_error_message: Requested connection ID is not defined
+      description: This error occurs when Airflow attempts to resolve a connection
+        using its standard secrets resolution flow (SecretCache and configured
+        secrets backends) and is unable to find any matching connection for
+        given conn_id. It also indicates that all configured backends were
+        checked sequentially but none returned a valid connection.
+      first_steps: >
+        Confirm that the connection is defined in at least one configured
+        secrets backend or  in the Airflow metadata database. Check whether

Review Comment:
   Stepping back to the design: this PR introduces a developer convention (error codes), a YAML registry, a Sphinx generator, a static check, and a mixin on shared exception classes. That's a substantial new mechanism with cross-cutting impact, and I think it needs more design buy-in before merging. A few questions I'd want answered up-thread:
   
   1. **Is there a dev list thread or AIP that endorses this whole proposal?** The PR body links #43171 (a rather different cleanup) but not a design discussion. @Lee-W referenced an "AirflowException should no longer be used" thread — that's adjacent but it's about *narrowing* what we share on a base class, while this PR *adds* a new shared mechanism on top of it. AGENTS.md "Boundaries → Ask first → Large cross-package refactors" applies; please link the discussion in the PR body, or start one if it hasn't happened.
   
   2. **kwarg vs embedded — Lee-W's open question.** The current shape makes `error_code` an opt-in kwarg that devs remember to pass at each raise site. With ~7 codes added across 7 raises in this PR (1:1), the embed-in-class alternative is barely heavier and gets you:
      - no per-raise discipline / no "the dev forgot" failure mode;
      - one source of truth (the class itself) for the code↔exception mapping rather than YAML + raise sites + class hierarchy all needing to agree;
      - the static check becomes "every `raise X(...)` where X is in the registry has the right code attached" instead of "the code that was passed matches" — stronger invariant.
   
      Your counter (multiple raise sites needing different codes) is real but IMO points at the answer being **subclass for the semantically distinct cases** rather than tagging a single class with multiple codes. e.g. `ConnectionNotFound(AirflowNotFoundException)` and `TaskSDKConnectionNotFound(AirflowNotFoundException)` is more pythonic than one `AirflowNotFoundException` with codes `AERR001` and `AERR002` distinguishing the two cases.
   
   3. **YAML as the registry has long-term cost.** Renaming an exception class today requires a code change *plus* a YAML edit *plus* a doc regeneration; the static check catches the YAML drift only on raise sites that opt in. A code-side registry (decorator on the class, or a class-attribute) would keep these in lockstep and remove the YAML round-trip entirely. Worth at least considering before YAML becomes the load-bearing source of truth.
   
   I don't think these are blockers in the "code is broken" sense — they're "is this the right shape before we ship it and have to live with it" sense. The implementation work here is solid; the design needs another pass with more maintainer eyes before it lands.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on PR #65423:
URL: https://github.com/apache/airflow/pull/65423#issuecomment-4320110812

   > To be able to usefully review this approach we need some examples of what the error codes would be and how/when then they would be raised -- it's too hard to picture in the abstract as it stands.
   
   Error codes would be in format AERR123. Every new error code can continue sequentially from last one in the error mapping. e.g. if AERR022 is the last one and we identify a new exception case, this new case can take AERR023 as its error code.
   
   Right now there's just one example case which is AERR001 [defined here](https://github.com/apache/airflow/pull/65423/changes#diff-87b94d009e537ae2e9945a4037d8b2dc1e2bc68b9741c1327ab0ade11013eaedR24-R31), I'll add a few more to some existing raises.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on PR #65423:
URL: https://github.com/apache/airflow/pull/65423#issuecomment-4495832898

   We could simply have error meta in exc doc string (Sphinx-parseable) -
   
   ```python
   class AirflowNotFoundException(AirflowException):
     """Raise when the requested object/resource is not available...
      
       :User-facing error message: "Requested resource was not found"
       :Description: "This error occurs when Airflow is unable to locate..."
       :First steps: "Verify that the requested..."
       :Documentation: "https://airflow.apache.org/docs/..."
     """
   ```
   
   No error mixin or additional properties, just plain doc string used to
   generate doc page for exception classes. Breaking changes won't be
   required and support for providers will come out of the box with doc
   string.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3217657338


##########
airflow-core/docs/error_mapping.yml:
##########
@@ -0,0 +1,149 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+
+error_guide:
+  description: Quick debug guide for common errors while using Airflow.
+  error_codes:
+    # Specify error codes below for exception classes as required.
+    # Exception class can have multiple error codes representing its respective error states.
+    # e.g. AirflowNotFoundException can have AERR001, AERR002, etc representing different not found cases.
+    - error_code: AERR001
+      exception_type: AirflowNotFoundException
+      user_facing_error_message: TaskSDK connection not found for requested connection ID
+      description: This error occurs when Airflow is unable to locate a connection
+        with given connection id in any configured secrets backend or metadata
+        store. It attempted to retrieve the connection via the Task SDK, but no
+        matching entry was found.
+      first_steps: Verify that the connection ID is correctly configured in Airflow.
+        Check your secrets backend, environment variables, or Airflow UI to
+        ensure the connection exists and is accessible to the current task.
+        Confirm there are no typos in the conn_id. If using a secrets backend,
+        ensure it is properly configured and reachable.
+      documentation: >
+        https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#using-connections
+
+    - error_code: AERR002
+      exception_type: AirflowNotFoundException
+      user_facing_error_message: Requested connection ID is not defined
+      description: This error occurs when Airflow attempts to resolve a connection
+        using its standard secrets resolution flow (SecretCache and configured
+        secrets backends) and is unable to find any matching connection for
+        given conn_id. It also indicates that all configured backends were
+        checked sequentially but none returned a valid connection.
+      first_steps: >
+        Confirm that the connection is defined in at least one configured
+        secrets backend or  in the Airflow metadata database. Check whether

Review Comment:
   Have started a design discussion on dev list: https://lists.apache.org/thread/f275xo3tjd4olsmrc8nggncs62fjnl0x



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3118461153


##########
airflow-core/docs/contributor/error_codes/AERR001.rst:
##########


Review Comment:
   If this file is generated by the ext generator it shouldn't be committed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3170146264


##########
airflow-core/src/airflow/models/connection.py:
##########
@@ -527,7 +527,9 @@ def get_connection_from_secrets(cls, conn_id: str, team_name: str | None = None)
                 return conn
             except AirflowRuntimeError as e:
                 if e.error.error == ErrorType.CONNECTION_NOT_FOUND:
-                    raise AirflowNotFoundException(f"The conn_id `{conn_id}` isn't defined") from None
+                    raise AirflowNotFoundException(
+                        f"The conn_id `{conn_id}` isn't defined", error_code="AERR002"

Review Comment:
   Still do you feel folks will totally miss using error_code if its non-mandatory? In that case I suppose we can make it mandatory/embedded.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3213684842


##########
devel-common/src/sphinx_exts/error_guide_generator.py:
##########
@@ -0,0 +1,133 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+import os
+from pathlib import Path
+
+import yaml
+
+AIRFLOW_ROOT_PATH = Path(os.path.abspath(__file__)).parents[3]
+GENERATED_PATH = AIRFLOW_ROOT_PATH / "airflow-core" / "docs" / "contributor" / "error_codes"
+GENERATED_PATH.mkdir(parents=True, exist_ok=True)

Review Comment:
   error_mapping.yml exists or not will be checked in the static check. And index.rst will be created irrespective of whether error_mapping.yml has any error codes. So all cases are covered here, please have a look at updated code. Thanks.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3219191732


##########
airflow-core/docs/index.rst:
##########
@@ -156,6 +156,7 @@ experience is continuously improving, but defining workflows as code is central
     best-practices
     faq
     troubleshooting
+    contributor/error_codes/index

Review Comment:
   Nothing else in the docs is under contributor is it? This seems like an odd location for it regardless.



##########
airflow-core/docs/error_mapping.yml:
##########
@@ -0,0 +1,713 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+error_codes:
+  # Specify error codes below for exception classes as required.
+  # Exception class can have multiple error codes representing its respective error states.
+  # e.g. AirflowNotFoundException can have AERR001, AERR002, etc representing different not found cases.
+  - error_code: AERR001
+    exception_type: AirflowNotFoundException
+    user_facing_error_message: Connection not found for requested connection ID
+    description: This error occurs when Airflow is unable to locate a connection
+      with given connection id in any configured secrets backend or metadata
+      store. It attempted to retrieve the connection, but no matching entry was found.
+    first_steps:
+      Verify that the connection ID is correctly configured in Airflow.
+      Check your secrets backend, environment variables, or Airflow UI to
+      ensure the connection exists and is accessible to the current task.
+      Confirm there are no typos in the conn_id. If using a secrets backend,
+      ensure it is properly configured and reachable.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#using-connections
+
+  - error_code: AERR002
+    exception_type: AirflowNotFoundException
+    user_facing_error_message: Requested connection ID is not defined
+    description: This error occurs when Airflow attempts to resolve a connection
+      using its standard secrets resolution flow (SecretCache and configured
+      secrets backends) and is unable to find any matching connection for
+      given connection ID. It also indicates that all configured backends were
+      checked sequentially but none returned a valid connection.
+    first_steps: >
+      Confirm that the connection is defined in at least one configured
+      secrets backend or  in the Airflow metadata database. Check whether
+      SecretCache is enabled and populated  correctly. Verify backend
+      configuration in airflow.cfg and ensure all external secrets  providers
+      (e.g., AWS Secrets Manager, HashiCorp Vault) are reachable and properly
+      authenticated.  Also confirm there are no typos in the conn_id and that
+      team_name (if used) matches the stored entry.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/security/secrets/secrets-backend/index.html
+
+  - error_code: AERR003
+    exception_type: AirflowTimetableInvalid
+    user_facing_error_message: Provided cron expression is invalid
+    description: This error is raised when Airflow attempts to validate a cron
+      expression using croniter and the expression is malformed or represents
+      an invalid schedule. It could either be due to invalid cron syntax or
+      invalid date/time values.
+    first_steps: >
+      Verify that the cron expression follows standard cron syntax (minute,
+      hour,  day of month, month, day of week). Check for invalid characters,
+      incorrect field counts,  or out-of-range values (e.g., minute > 59,
+      month > 12). Test the expression using a cron  validator or croniter
+      directly in a Python shell. If using presets or dynamic inputs,
+      ensure  they resolve to valid cron strings.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/cron.html
+
+  - error_code: AERR004
+    exception_type: AirflowTimetableInvalid
+    user_facing_error_message: Cron schedule interval must be a positive duration
+    description: >
+      This error occurs when Airflow validates a timetable based on a time
+      duration and finds that the resulting scheduled time is not in the
+      future. Specifically, if adding the provided interval to the current
+      time does not advance time (i.e., its either now or before now), the
+      interval is  considered zero or negative. This violates Airflow's
+      requirement that scheduling intervals  must move forward in time.
+    first_steps: >
+      Check the value of the provided cron schedule interval and ensure it
+      represents a strictly positive duration. Verify that none of its
+      components (days, seconds, etc.) result in a zero or negative total. If
+      the interval is dynamically computed, inspect the logic to confirm it
+      cannot produce negative or zero values.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/timetable.html
+
+  - error_code: AERR005
+    exception_type: AirflowTimetableInvalid
+    user_facing_error_message: Asset-based timetables cannot be nested
+    description:
+      This error occurs when Airflow validates a timetable configuration
+      and detects that an AssetTriggeredTimetable is being used inside another
+      timetable. Nested asset-driven scheduling is not supported because
+      asset-triggered timetables are designed to operate as top-level
+      scheduling constructs. Attempting to embed one within another leads to
+      ambiguous or conflicting scheduling behavior, so Airflow raises an
+      AirflowTimetableInvalid exception.
+    first_steps: >
+      Review the timetable configuration and ensure that an
+      AssetTriggeredTimetable is not being passed as a nested or inner
+      timetable. If you need multiple scheduling conditions, consider
+      restructuring the DAG to use a single asset-based timetable or separate
+      DAGs. Confirm that the timetable parameter is a supported non-asset
+      timetable type when combined with asset conditions.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/assets.html
+
+  - error_code: AERR006
+    exception_type: AirflowTimetableInvalid
+    user_facing_error_message: All elements in 'assets' must be valid asset objects
+    description: This error is raised when Airflow validates the asset condition
+      configuration and finds that one or more elements are serialized.
+      Asset-based scheduling requires all provided assets to be properly
+      serialized asset objects so they can be tracked and evaluated by the
+      scheduler. Passing unsupported types (e.g., strings, dictionaries, or
+      uninitialized objects) causes this validation to fail.
+    first_steps: >
+      Inspect the asset contents or asset_condition input and ensure each
+      element is serializable i.e. an  instance of SerializedAssetBase. If
+      assets are being dynamically constructed, verify they are properly
+      serialized before being passed. Avoid using raw identifiers or
+      unsupported data types, and instead use the appropriate Airflow asset
+      classes or serialization utilities.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/serializers.html
+
+  - error_code: AERR007
+    exception_type: TaskNotFound
+    user_facing_error_message: Requested task ID was not found in the DAG
+    description:
+      This error occurs when Airflow attempts to retrieve a task from the
+      DAG using a given task_id, but no matching entry exists in the internal
+      task_dict. It indicates that the specified task ID is either incorrect,
+      missing, or not registered as part of the DAG definition.
+    first_steps: >
+      Verify that the task_id is spelled correctly and matches exactly with
+      the task defined in the DAG (including case sensitivity). Check that the
+      task is properly instantiated and added to the DAG context. If the
+      task_id is dynamically generated, confirm the logic produces the
+      expected value. Also ensure that the DAG has been fully parsed and all
+      tasks are registered before attempting retrieval.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/tasks.html
+
+  - error_code: AERR008
+    exception_type: NodeNotFound

Review Comment:
   TaskNotFound is essentially the same as NodeNotFound.



##########
airflow-core/docs/error_mapping.yml:
##########
@@ -0,0 +1,713 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+error_codes:
+  # Specify error codes below for exception classes as required.
+  # Exception class can have multiple error codes representing its respective error states.
+  # e.g. AirflowNotFoundException can have AERR001, AERR002, etc representing different not found cases.
+  - error_code: AERR001
+    exception_type: AirflowNotFoundException
+    user_facing_error_message: Connection not found for requested connection ID
+    description: This error occurs when Airflow is unable to locate a connection
+      with given connection id in any configured secrets backend or metadata
+      store. It attempted to retrieve the connection, but no matching entry was found.
+    first_steps:
+      Verify that the connection ID is correctly configured in Airflow.
+      Check your secrets backend, environment variables, or Airflow UI to
+      ensure the connection exists and is accessible to the current task.
+      Confirm there are no typos in the conn_id. If using a secrets backend,
+      ensure it is properly configured and reachable.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#using-connections
+
+  - error_code: AERR002
+    exception_type: AirflowNotFoundException
+    user_facing_error_message: Requested connection ID is not defined
+    description: This error occurs when Airflow attempts to resolve a connection
+      using its standard secrets resolution flow (SecretCache and configured
+      secrets backends) and is unable to find any matching connection for
+      given connection ID. It also indicates that all configured backends were
+      checked sequentially but none returned a valid connection.
+    first_steps: >
+      Confirm that the connection is defined in at least one configured
+      secrets backend or  in the Airflow metadata database. Check whether
+      SecretCache is enabled and populated  correctly. Verify backend
+      configuration in airflow.cfg and ensure all external secrets  providers
+      (e.g., AWS Secrets Manager, HashiCorp Vault) are reachable and properly
+      authenticated.  Also confirm there are no typos in the conn_id and that
+      team_name (if used) matches the stored entry.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/security/secrets/secrets-backend/index.html
+
+  - error_code: AERR003
+    exception_type: AirflowTimetableInvalid
+    user_facing_error_message: Provided cron expression is invalid
+    description: This error is raised when Airflow attempts to validate a cron
+      expression using croniter and the expression is malformed or represents
+      an invalid schedule. It could either be due to invalid cron syntax or
+      invalid date/time values.
+    first_steps: >
+      Verify that the cron expression follows standard cron syntax (minute,
+      hour,  day of month, month, day of week). Check for invalid characters,
+      incorrect field counts,  or out-of-range values (e.g., minute > 59,
+      month > 12). Test the expression using a cron  validator or croniter
+      directly in a Python shell. If using presets or dynamic inputs,
+      ensure  they resolve to valid cron strings.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/cron.html
+
+  - error_code: AERR004
+    exception_type: AirflowTimetableInvalid
+    user_facing_error_message: Cron schedule interval must be a positive duration
+    description: >
+      This error occurs when Airflow validates a timetable based on a time
+      duration and finds that the resulting scheduled time is not in the
+      future. Specifically, if adding the provided interval to the current
+      time does not advance time (i.e., its either now or before now), the
+      interval is  considered zero or negative. This violates Airflow's
+      requirement that scheduling intervals  must move forward in time.
+    first_steps: >
+      Check the value of the provided cron schedule interval and ensure it
+      represents a strictly positive duration. Verify that none of its
+      components (days, seconds, etc.) result in a zero or negative total. If
+      the interval is dynamically computed, inspect the logic to confirm it
+      cannot produce negative or zero values.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/timetable.html
+
+  - error_code: AERR005
+    exception_type: AirflowTimetableInvalid
+    user_facing_error_message: Asset-based timetables cannot be nested
+    description:
+      This error occurs when Airflow validates a timetable configuration
+      and detects that an AssetTriggeredTimetable is being used inside another
+      timetable. Nested asset-driven scheduling is not supported because
+      asset-triggered timetables are designed to operate as top-level
+      scheduling constructs. Attempting to embed one within another leads to
+      ambiguous or conflicting scheduling behavior, so Airflow raises an
+      AirflowTimetableInvalid exception.
+    first_steps: >
+      Review the timetable configuration and ensure that an
+      AssetTriggeredTimetable is not being passed as a nested or inner
+      timetable. If you need multiple scheduling conditions, consider
+      restructuring the DAG to use a single asset-based timetable or separate
+      DAGs. Confirm that the timetable parameter is a supported non-asset
+      timetable type when combined with asset conditions.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/assets.html
+
+  - error_code: AERR006
+    exception_type: AirflowTimetableInvalid
+    user_facing_error_message: All elements in 'assets' must be valid asset objects
+    description: This error is raised when Airflow validates the asset condition
+      configuration and finds that one or more elements are serialized.
+      Asset-based scheduling requires all provided assets to be properly
+      serialized asset objects so they can be tracked and evaluated by the
+      scheduler. Passing unsupported types (e.g., strings, dictionaries, or
+      uninitialized objects) causes this validation to fail.
+    first_steps: >
+      Inspect the asset contents or asset_condition input and ensure each
+      element is serializable i.e. an  instance of SerializedAssetBase. If
+      assets are being dynamically constructed, verify they are properly
+      serialized before being passed. Avoid using raw identifiers or
+      unsupported data types, and instead use the appropriate Airflow asset
+      classes or serialization utilities.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/serializers.html
+
+  - error_code: AERR007
+    exception_type: TaskNotFound
+    user_facing_error_message: Requested task ID was not found in the DAG
+    description:
+      This error occurs when Airflow attempts to retrieve a task from the
+      DAG using a given task_id, but no matching entry exists in the internal
+      task_dict. It indicates that the specified task ID is either incorrect,
+      missing, or not registered as part of the DAG definition.
+    first_steps: >
+      Verify that the task_id is spelled correctly and matches exactly with
+      the task defined in the DAG (including case sensitivity). Check that the
+      task is properly instantiated and added to the DAG context. If the
+      task_id is dynamically generated, confirm the logic produces the
+      expected value. Also ensure that the DAG has been fully parsed and all
+      tasks are registered before attempting retrieval.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/tasks.html
+
+  - error_code: AERR008
+    exception_type: NodeNotFound
+    user_facing_error_message: Requested task label was not found in the DAG
+    description:
+      This error occurs when Airflow attempts to retrieve a task from the
+      DAG using a label, but no matching entry exists in the internal
+      task_dict. It indicates that the specified task label is either incorrect,
+      missing, or not registered as part of the DAG definition.
+    first_steps: >
+      Verify that the task label is spelled correctly and matches exactly with
+      the task defined in the DAG (including case sensitivity). Check that the
+      task is properly instantiated and added to the DAG context. If the
+      task label is dynamically generated, confirm the logic produces the
+      expected value. Also ensure that the DAG has been fully parsed and all
+      tasks are registered before attempting retrieval.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/tasks.html
+
+  - error_code: AERR009
+    exception_type: DagCodeNotFound
+    user_facing_error_message: DAG source code could not be found in metadata database

Review Comment:
   Is this exposed to a user anywhere? I think it is just an internal exception that is caught by the API server



##########
airflow-core/docs/error_mapping.yml:
##########
@@ -0,0 +1,713 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+error_codes:
+  # Specify error codes below for exception classes as required.
+  # Exception class can have multiple error codes representing its respective error states.
+  # e.g. AirflowNotFoundException can have AERR001, AERR002, etc representing different not found cases.
+  - error_code: AERR001
+    exception_type: AirflowNotFoundException
+    user_facing_error_message: Connection not found for requested connection ID
+    description: This error occurs when Airflow is unable to locate a connection
+      with given connection id in any configured secrets backend or metadata
+      store. It attempted to retrieve the connection, but no matching entry was found.
+    first_steps:
+      Verify that the connection ID is correctly configured in Airflow.
+      Check your secrets backend, environment variables, or Airflow UI to
+      ensure the connection exists and is accessible to the current task.
+      Confirm there are no typos in the conn_id. If using a secrets backend,
+      ensure it is properly configured and reachable.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#using-connections
+
+  - error_code: AERR002
+    exception_type: AirflowNotFoundException
+    user_facing_error_message: Requested connection ID is not defined
+    description: This error occurs when Airflow attempts to resolve a connection
+      using its standard secrets resolution flow (SecretCache and configured
+      secrets backends) and is unable to find any matching connection for
+      given connection ID. It also indicates that all configured backends were
+      checked sequentially but none returned a valid connection.
+    first_steps: >
+      Confirm that the connection is defined in at least one configured
+      secrets backend or  in the Airflow metadata database. Check whether
+      SecretCache is enabled and populated  correctly. Verify backend
+      configuration in airflow.cfg and ensure all external secrets  providers
+      (e.g., AWS Secrets Manager, HashiCorp Vault) are reachable and properly
+      authenticated.  Also confirm there are no typos in the conn_id and that
+      team_name (if used) matches the stored entry.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/security/secrets/secrets-backend/index.html
+
+  - error_code: AERR003
+    exception_type: AirflowTimetableInvalid
+    user_facing_error_message: Provided cron expression is invalid
+    description: This error is raised when Airflow attempts to validate a cron
+      expression using croniter and the expression is malformed or represents
+      an invalid schedule. It could either be due to invalid cron syntax or
+      invalid date/time values.
+    first_steps: >
+      Verify that the cron expression follows standard cron syntax (minute,
+      hour,  day of month, month, day of week). Check for invalid characters,
+      incorrect field counts,  or out-of-range values (e.g., minute > 59,
+      month > 12). Test the expression using a cron  validator or croniter
+      directly in a Python shell. If using presets or dynamic inputs,
+      ensure  they resolve to valid cron strings.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/cron.html
+
+  - error_code: AERR004
+    exception_type: AirflowTimetableInvalid
+    user_facing_error_message: Cron schedule interval must be a positive duration
+    description: >
+      This error occurs when Airflow validates a timetable based on a time
+      duration and finds that the resulting scheduled time is not in the
+      future. Specifically, if adding the provided interval to the current
+      time does not advance time (i.e., its either now or before now), the
+      interval is  considered zero or negative. This violates Airflow's
+      requirement that scheduling intervals  must move forward in time.
+    first_steps: >
+      Check the value of the provided cron schedule interval and ensure it
+      represents a strictly positive duration. Verify that none of its
+      components (days, seconds, etc.) result in a zero or negative total. If
+      the interval is dynamically computed, inspect the logic to confirm it
+      cannot produce negative or zero values.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/timetable.html
+
+  - error_code: AERR005
+    exception_type: AirflowTimetableInvalid
+    user_facing_error_message: Asset-based timetables cannot be nested
+    description:
+      This error occurs when Airflow validates a timetable configuration
+      and detects that an AssetTriggeredTimetable is being used inside another
+      timetable. Nested asset-driven scheduling is not supported because
+      asset-triggered timetables are designed to operate as top-level
+      scheduling constructs. Attempting to embed one within another leads to
+      ambiguous or conflicting scheduling behavior, so Airflow raises an
+      AirflowTimetableInvalid exception.
+    first_steps: >
+      Review the timetable configuration and ensure that an
+      AssetTriggeredTimetable is not being passed as a nested or inner
+      timetable. If you need multiple scheduling conditions, consider
+      restructuring the DAG to use a single asset-based timetable or separate
+      DAGs. Confirm that the timetable parameter is a supported non-asset
+      timetable type when combined with asset conditions.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/assets.html
+
+  - error_code: AERR006
+    exception_type: AirflowTimetableInvalid
+    user_facing_error_message: All elements in 'assets' must be valid asset objects
+    description: This error is raised when Airflow validates the asset condition
+      configuration and finds that one or more elements are serialized.
+      Asset-based scheduling requires all provided assets to be properly
+      serialized asset objects so they can be tracked and evaluated by the
+      scheduler. Passing unsupported types (e.g., strings, dictionaries, or
+      uninitialized objects) causes this validation to fail.
+    first_steps: >
+      Inspect the asset contents or asset_condition input and ensure each
+      element is serializable i.e. an  instance of SerializedAssetBase. If
+      assets are being dynamically constructed, verify they are properly
+      serialized before being passed. Avoid using raw identifiers or
+      unsupported data types, and instead use the appropriate Airflow asset
+      classes or serialization utilities.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/serializers.html
+
+  - error_code: AERR007
+    exception_type: TaskNotFound
+    user_facing_error_message: Requested task ID was not found in the DAG
+    description:
+      This error occurs when Airflow attempts to retrieve a task from the
+      DAG using a given task_id, but no matching entry exists in the internal
+      task_dict. It indicates that the specified task ID is either incorrect,
+      missing, or not registered as part of the DAG definition.
+    first_steps: >
+      Verify that the task_id is spelled correctly and matches exactly with
+      the task defined in the DAG (including case sensitivity). Check that the
+      task is properly instantiated and added to the DAG context. If the
+      task_id is dynamically generated, confirm the logic produces the
+      expected value. Also ensure that the DAG has been fully parsed and all
+      tasks are registered before attempting retrieval.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/tasks.html
+
+  - error_code: AERR008
+    exception_type: NodeNotFound
+    user_facing_error_message: Requested task label was not found in the DAG
+    description:
+      This error occurs when Airflow attempts to retrieve a task from the
+      DAG using a label, but no matching entry exists in the internal
+      task_dict. It indicates that the specified task label is either incorrect,
+      missing, or not registered as part of the DAG definition.
+    first_steps: >
+      Verify that the task label is spelled correctly and matches exactly with
+      the task defined in the DAG (including case sensitivity). Check that the
+      task is properly instantiated and added to the DAG context. If the
+      task label is dynamically generated, confirm the logic produces the
+      expected value. Also ensure that the DAG has been fully parsed and all
+      tasks are registered before attempting retrieval.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/tasks.html
+
+  - error_code: AERR009
+    exception_type: DagCodeNotFound
+    user_facing_error_message: DAG source code could not be found in metadata database
+    description: >
+      This error occurs when Airflow attempts to retrieve DAG source code
+      from the metadata database using a dag_id, but no matching DagCode
+      record exists. The lookup queries the latest stored DAG code entry
+      ordered by last_updated, and raises DagCodeNotFound when the query
+      returns no result. This usually indicates that the DAG has not yet
+      been serialized into the database, has been removed, or the dag_id
+      provided does not match any registered DAG code entry.
+    first_steps: >
+      Verify that the dag_id exists and matches the expected DAG exactly,
+      including case sensitivity. Confirm that the DAG file has been parsed
+      successfully by the scheduler and that DAG serialization or DAG code
+      persistence is functioning correctly. Check whether the DAG was recently
+      deleted, renamed, or excluded from parsing. Also inspect the dag_code
+      table in the Airflow metadata database to ensure the corresponding
+      source code entry is present.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/dag-serialization.html
+
+  - error_code: AERR010
+    exception_type: DagNotFound
+    user_facing_error_message: Requested DAG could not be found
+    description: >
+      This error occurs when Airflow attempts to perform a dry run operation
+      on a DAG but cannot locate the corresponding serialized DAG definition
+      in the metadata database. The system queries the latest serialized DAG
+      record for the provided dag_id, and raises DagNotFound when no matching
+      entry exists. This typically indicates that the DAG has not been parsed,
+      has not been serialized, has been deleted, or the dag_id provided does
+      not correspond to any known DAG in the system.
+    first_steps: >
+      Verify that the dag_id is correct and matches an existing DAG definition
+      exactly, including case sensitivity. Ensure that the DAG file is present
+      in the DAGs folder and has been successfully parsed by the scheduler.
+      Confirm that DAG serialization is enabled and functioning properly, and
+      that the SerializedDagModel table contains entries for the DAG. If the
+      DAG was recently added, allow time for the scheduler to pick it up and
+      serialize it.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/dags.html
+
+  - error_code: AERR011
+    exception_type: DagNotFound
+    user_facing_error_message: Requested DAG could not be found for backfill operation
+    description: >
+      This error occurs when Airflow attempts to create a backfill job for a
+      specified DAG but cannot locate its serialized definition in the metadata
+      database. The system queries the latest serialized DAG entry using the
+      provided dag_id, and raises DagNotFound when no corresponding record is
+      found. This indicates that the DAG is missing from the serialized DAG store,
+      has not been parsed or serialized yet, or the dag_id does not match any
+      registered DAG in the system.
+    first_steps: >
+      Verify that the dag_id is correct and matches an existing DAG definition
+      exactly, including case sensitivity. Ensure the DAG file is present in the
+      DAGs directory and has been successfully parsed by the scheduler. Confirm
+      that DAG serialization is enabled and that entries exist in the
+      SerializedDagModel table for the given DAG. If the DAG was recently added or
+      modified, allow time for the scheduler to process and serialize it before
+      retrying the backfill operation.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/dags.html
+
+  - error_code: AERR012
+    exception_type: PoolNotFound
+    user_facing_error_message: Pool deletion failed because the pool is either protected or does not exist
+    description: >
+      This error occurs when Airflow attempts to delete a pool but the operation
+      cannot be completed due to one of two conditions. If the requested pool is
+      the default pool, Airflow raises AirflowException because the default pool
+      is a protected system resource and cannot be removed. If the specified pool
+      name does not exist in the metadata database, PoolNotFound is raised. In both
+      cases, the deletion process is aborted before any database modification occurs.
+    first_steps: >
+      If the error is due to the default pool, verify that the pool name is not
+      "default_pool", as this pool is reserved and cannot be deleted. If the error
+      indicates PoolNotFound, confirm that the pool name is spelled correctly and
+      exists in the Airflow metadata database. You can list available pools via the
+      Airflow CLI or UI to validate existence before attempting deletion.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/pools.html
+
+  - error_code: AERR013
+    exception_type: DagNotFound
+    user_facing_error_message: Requested DAG could not be found for triggering a DAG run
+    description: >
+      This error occurs when Airflow attempts to trigger a DAG run but cannot
+      locate the latest version of the specified DAG within the DagBag or metadata
+      store. The system calls get_latest_version_of_dag(dag_id), and raises
+      DagNotFound when no matching DAG definition is found. This indicates that
+      the DAG is missing, not yet parsed, not included in the DAG bag, or the
+      dag_id does not correspond to any currently available DAG version.
+    first_steps: >
+      Verify that the dag_id is correct and matches an existing DAG definition
+      exactly, including case sensitivity. Ensure that the DAG file is present in
+      the DAGs directory and has been successfully parsed by the scheduler. Check
+      that the DAG is not paused or filtered out from the DagBag. If the DAG was
+      recently added or modified, confirm that the scheduler has reloaded it and
+      that it appears in the Airflow UI before retrying the trigger operation.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/dags.html
+
+  - error_code: AERR014
+    exception_type: DagNotFound
+    user_facing_error_message: Requested DAG could not be found in the DagModel registry
+    description: >
+      This error occurs when Airflow attempts to trigger a DAG run but cannot
+      locate the corresponding DAG entry in the DagModel table. The system raises
+      DagNotFound when no active or registered DAG record exists for the provided
+      dag_id. This indicates that the DAG is either not present in the metadata database,
+      has not been parsed and registered by the scheduler, or has been removed or renamed.
+    first_steps: >
+      Verify that the dag_id is correct and exactly matches an existing DAG
+      definition, including case sensitivity. Ensure the DAG file exists in the
+      configured DAGs folder and has been successfully parsed by the scheduler.
+      Check the Airflow UI or DagModel records in the metadata database to
+      confirm that the DAG is registered and active. If the DAG was recently
+      added or modified, allow time for scheduler parsing and metadata updates
+      before retrying the trigger operation.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/dags.html
+
+  - error_code: AERR015
+    exception_type: DagNotFound
+    user_facing_error_message: DAG deletion failed because active tasks exist or the DAG does not exist
+    description: >
+      This error occurs when Airflow attempts to delete a DAG but cannot proceed
+      due to one of two blocking conditions. If any TaskInstance for the DAG is
+      still in the RUNNING state, an AirflowException is raised to prevent unsafe
+      deletion while work is still executing. If no matching DagModel entry exists
+      for the provided dag_id, DagNotFound is raised, indicating that the DAG is
+      not registered in the metadata database. In both cases, deletion is aborted
+      to maintain consistency between the DAG registry and task execution state.
+    first_steps: >
+      If the error is caused by running tasks, ensure all active TaskInstances for
+      the DAG are completed, failed, or cleared before retrying deletion. You can
+      verify task state via the Airflow UI, CLI, or metadata database. If the error
+      is DagNotFound, confirm that the dag_id is correct and exists in DagModel.
+      Check whether the DAG has already been deleted, renamed, or never registered
+      due to parsing issues. Validate DAG presence in the Airflow UI before retrying.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/dags.html
+
+  - error_code: AERR016
+    exception_type: DagNotFound
+    user_facing_error_message: DAG definition could not be found in the serialized DAG store
+    description: >
+      This error occurs when Airflow attempts to retrieve a DAG from the serialized
+      DAG store for a task instance execution, but no corresponding serialized DAG
+      entry exists. The system queries the scheduler DAG bag for the DAG associated
+      with the given dag_run, and raises DagNotFound when the serialized_dag table
+      does not contain a matching record. This indicates that the DAG has not been
+      serialized, is missing from the metadata database, or is unavailable to the
+      scheduler at runtime.
+    first_steps: >
+      Verify that the dag_id exists and is correctly defined in the DAG files.
+      Ensure that the scheduler has successfully parsed and serialized the DAG.
+      Check the serialized_dag table in the metadata database to confirm that an
+      entry exists for the given DAG. If the DAG was recently deployed or updated,
+      allow time for the scheduler to process and serialize it. Also verify that
+      the DAG is not excluded by DAG serialization settings or scheduler filters.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/dag-serialization.html
+
+  - error_code: AERR017
+    exception_type: DagRunNotFound
+    user_facing_error_message: >
+      Requested DagRun could not be found for the given run identifier or logical date
+    description: >
+      This error occurs when Airflow attempts to retrieve a DagRun using either a
+      run_id or logical_date, but no matching DagRun exists in the metadata database.
+      The system first tries to resolve the identifier and if no DagRun is found and
+      creation of a new DagRun is not allowed then a DagRunNotFound exception is raised.
+      This indicates that the requested DAG run has not been created, has been deleted,
+      or the provided identifier does not match any existing DagRun.
+    first_steps: >
+      Verify that the run_id or logical_date is correct and corresponds to an existing
+      DagRun for the specified dag_id. Check the Airflow UI or DagRun table in the
+      metadata database to confirm whether the run exists. Ensure that the correct
+      time format is used for logical_date and that timezone handling matches the DAG
+      configuration. If the DagRun is expected to be created automatically, confirm
+      whether create_if_necessary is enabled in the calling context.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/dags.html
+
+  - error_code: AERR018
+    exception_type: TaskInstanceNotFound
+    user_facing_error_message: Requested TaskInstance could not be found for the given DAG run and task
+    description: >
+      This error occurs when Airflow attempts to retrieve a TaskInstance from a
+      DagRun using the provided task_id and map_index, but no matching record exists.
+      The system calls dag_run.get_task_instance(...) to locate the task instance,
+      and if no TaskInstance is found and creation is not permitted
+      (create_if_necessary=False), a TaskInstanceNotFound exception is raised.
+      This indicates that the TaskInstance has not been created yet, does not exist
+      for the specified DagRun, or the provided identifiers (task_id, map_index,
+      run_id/logical_date) do not correspond to an existing execution record.
+    first_steps: >
+      Verify that the task_id exists in the DAG definition and is correctly spelled,
+      including case sensitivity. Ensure that the DagRun for the given run_id or
+      logical_date exists and has been properly created. If using mapped tasks,
+      confirm that the map index is valid and corresponds to an existing mapped
+      task instance. Check the Airflow UI or TaskInstance table in the metadata
+      database to verify whether the task instance exists. If the DAG run is new,
+      ensure that task instances have been generated before attempting retrieval.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/tasks.html
+
+  - error_code: AERR019
+    exception_type: DagRunNotFound
+    user_facing_error_message: Requested DagRun could not be found when fetching task states
+    description: >
+      This error occurs when Airflow CLI attempts to retrieve the status of all
+      TaskInstances within a specific DagRun, but no matching DagRun exists in the
+      metadata database. The command resolves the DagRun and raises DagRunNotFound
+      when no corresponding DagRun is found for the given dag_id. This indicates that
+      the requested DAG run does not exist, has been deleted, or the provided identifier
+      does not match any stored execution record.
+    first_steps: >
+      Verify that the dag_id is correct and matches an existing DAG. Ensure that
+      the run_id or logical_date provided corresponds to an actual DagRun, which
+      can be confirmed via the Airflow UI or DagRun database table. Check that the
+      correct execution date format and timezone are used for logical_date inputs.
+      If the DagRun was recently created, ensure it has been fully registered before
+      retrying the CLI command.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/dags.html
+
+  - error_code: AERR020
+    exception_type: PoolNotFound
+    user_facing_error_message: Requested pool could not be found
+    description: >
+      This error occurs when Airflow attempts to retrieve a pool definition
+      using the provided pool name, but no matching pool exists in the metadata
+      database. Airflow raises PoolNotFound when the pool name lookup returns no result.
+      This indicates that the specified pool has not been created, has been deleted, or
+      the provided pool name does not exactly match any existing pool configuration.
+    first_steps: >
+      Verify that the pool name is correct and matches an existing Airflow pool.
+      Check the Airflow UI under Admin > Pools or query the metadata database to
+      confirm the pool exists. Ensure there are no typographical errors, case
+      mismatches, or environment-specific configuration differences. If the pool
+      was recently created, verify that the scheduler and webserver are using the
+      latest metadata state before retrying the operation.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/pools.html
+
+  - error_code: AERR021
+    exception_type: AirflowNotFoundException
+    user_facing_error_message: S3 object not found for the specified bucket and key
+    description: >
+      This error occurs within the Apache Airflow Amazon provider when an S3Hook attempts to retrieve
+      an object from an Amazon S3 bucket, but the specified key does not exist. The underlying AWS
+      ClientError returns a 404 (NoSuchKey), which indicates that the object could not be found in the
+      bucket. Airflow translates this into an AirflowNotFoundException to signal a missing upstream
+      artifact or data dependency in the DAG workflow.
+    first_steps:
+      Verify that the S3 bucket name and object key used in the Airflow task are correct. Check the
+      Amazon S3 console to confirm the object exists at the expected path. Ensure upstream Airflow
+      tasks (e.g., S3 upload or data generation steps) completed successfully. Validate that the Airflow
+      S3Hook is using the correct AWS connection configured in Airflow Connections. Confirm that the
+      IAM role or credentials associated with the Airflow connection have access to the bucket and object.
+      Check for environment mismatches such as dev/staging/prod bucket configuration.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/hooks/s3/index.html
+
+  - error_code: AERR022
+    exception_type: AirflowNotFoundException
+    user_facing_error_message: Docker registry configuration is incomplete
+    description: >
+      This error occurs within the Apache Airflow Docker provider when attempting to authenticate
+      or connect to a Docker registry but required connection parameters are missing. Docker
+      connection (Airflow Connection object) is missing either the registry URL or the username.
+      Since both fields are required for registry authentication, Airflow raises an exception to
+      indicate that the Docker registry connection is not properly configured in Airflow Connections.
+    first_steps:
+      Verify that the Airflow Docker connection (conn_id) is configured correctly in the Airflow UI or
+      secrets backend. Ensure the 'host' field contains a valid Docker registry URL (e.g.,
+      https://index.docker.io/v1/ or private registry URL). Ensure the 'login' field (username) is set
+      in the connection configuration. If using a private registry, confirm that credentials are correctly
+      stored and accessible to Airflow. Check whether the correct conn_id is being passed to the DockerHook
+      or DockerOperator. Validate that environment-specific overrides (dev/staging/prod) are not missing
+      required fields.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow-providers-docker/stable/_api/airflow/providers/docker/hooks/docker/index.html
+
+  - error_code: AERR023
+    exception_type: AirflowNotFoundException
+    user_facing_error_message: Ray job not found on the cluster
+    description: >
+      This error occurs in the Apache Airflow Ray provider when the Ray operator attempts to stop a
+      job on a Ray cluster, but the specified job_id does not exist or is no longer available. The underlying
+      Ray client raises a NotFound exception, indicating that the job could not be located on the cluster.
+      Airflow converts this into an AirflowNotFoundException to indicate that the requested Ray job is
+      missing or has already completed, been removed, or is not recognized by the cluster.
+    first_steps:
+      Verify that the job_id corresponds to an existing Ray job submission on the target cluster.
+      Check the Ray dashboard to confirm whether the job is still running or already completed.
+      Ensure the cluster_address points to the correct Ray cluster environment.
+      Confirm that the job was not already stopped or cleaned up by another operator or retention policy.
+      Validate that the DAG is not using an outdated or incorrect job_id reference.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow-providers-google/stable/operators/cloud/ray.html
+
+  - error_code: AERR024
+    exception_type: AirflowNotFoundException
+    user_facing_error_message: Google Ads link not found for the specified property

Review Comment:
   This is specific to a provider so should not be in the main list



##########
airflow-core/docs/error_mapping.yml:
##########
@@ -0,0 +1,713 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+error_codes:
+  # Specify error codes below for exception classes as required.
+  # Exception class can have multiple error codes representing its respective error states.
+  # e.g. AirflowNotFoundException can have AERR001, AERR002, etc representing different not found cases.
+  - error_code: AERR001
+    exception_type: AirflowNotFoundException
+    user_facing_error_message: Connection not found for requested connection ID
+    description: This error occurs when Airflow is unable to locate a connection
+      with given connection id in any configured secrets backend or metadata
+      store. It attempted to retrieve the connection, but no matching entry was found.
+    first_steps:
+      Verify that the connection ID is correctly configured in Airflow.
+      Check your secrets backend, environment variables, or Airflow UI to
+      ensure the connection exists and is accessible to the current task.
+      Confirm there are no typos in the conn_id. If using a secrets backend,
+      ensure it is properly configured and reachable.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#using-connections
+
+  - error_code: AERR002
+    exception_type: AirflowNotFoundException
+    user_facing_error_message: Requested connection ID is not defined
+    description: This error occurs when Airflow attempts to resolve a connection
+      using its standard secrets resolution flow (SecretCache and configured
+      secrets backends) and is unable to find any matching connection for
+      given connection ID. It also indicates that all configured backends were
+      checked sequentially but none returned a valid connection.
+    first_steps: >
+      Confirm that the connection is defined in at least one configured
+      secrets backend or  in the Airflow metadata database. Check whether
+      SecretCache is enabled and populated  correctly. Verify backend
+      configuration in airflow.cfg and ensure all external secrets  providers
+      (e.g., AWS Secrets Manager, HashiCorp Vault) are reachable and properly
+      authenticated.  Also confirm there are no typos in the conn_id and that
+      team_name (if used) matches the stored entry.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/security/secrets/secrets-backend/index.html
+
+  - error_code: AERR003
+    exception_type: AirflowTimetableInvalid
+    user_facing_error_message: Provided cron expression is invalid
+    description: This error is raised when Airflow attempts to validate a cron
+      expression using croniter and the expression is malformed or represents
+      an invalid schedule. It could either be due to invalid cron syntax or
+      invalid date/time values.
+    first_steps: >
+      Verify that the cron expression follows standard cron syntax (minute,
+      hour,  day of month, month, day of week). Check for invalid characters,
+      incorrect field counts,  or out-of-range values (e.g., minute > 59,
+      month > 12). Test the expression using a cron  validator or croniter
+      directly in a Python shell. If using presets or dynamic inputs,
+      ensure  they resolve to valid cron strings.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/cron.html
+
+  - error_code: AERR004
+    exception_type: AirflowTimetableInvalid
+    user_facing_error_message: Cron schedule interval must be a positive duration
+    description: >
+      This error occurs when Airflow validates a timetable based on a time
+      duration and finds that the resulting scheduled time is not in the
+      future. Specifically, if adding the provided interval to the current
+      time does not advance time (i.e., its either now or before now), the
+      interval is  considered zero or negative. This violates Airflow's
+      requirement that scheduling intervals  must move forward in time.
+    first_steps: >
+      Check the value of the provided cron schedule interval and ensure it
+      represents a strictly positive duration. Verify that none of its
+      components (days, seconds, etc.) result in a zero or negative total. If
+      the interval is dynamically computed, inspect the logic to confirm it
+      cannot produce negative or zero values.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/timetable.html
+
+  - error_code: AERR005
+    exception_type: AirflowTimetableInvalid
+    user_facing_error_message: Asset-based timetables cannot be nested
+    description:
+      This error occurs when Airflow validates a timetable configuration
+      and detects that an AssetTriggeredTimetable is being used inside another
+      timetable. Nested asset-driven scheduling is not supported because
+      asset-triggered timetables are designed to operate as top-level
+      scheduling constructs. Attempting to embed one within another leads to
+      ambiguous or conflicting scheduling behavior, so Airflow raises an
+      AirflowTimetableInvalid exception.
+    first_steps: >
+      Review the timetable configuration and ensure that an
+      AssetTriggeredTimetable is not being passed as a nested or inner
+      timetable. If you need multiple scheduling conditions, consider
+      restructuring the DAG to use a single asset-based timetable or separate
+      DAGs. Confirm that the timetable parameter is a supported non-asset
+      timetable type when combined with asset conditions.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/assets.html
+
+  - error_code: AERR006
+    exception_type: AirflowTimetableInvalid
+    user_facing_error_message: All elements in 'assets' must be valid asset objects
+    description: This error is raised when Airflow validates the asset condition
+      configuration and finds that one or more elements are serialized.
+      Asset-based scheduling requires all provided assets to be properly
+      serialized asset objects so they can be tracked and evaluated by the
+      scheduler. Passing unsupported types (e.g., strings, dictionaries, or
+      uninitialized objects) causes this validation to fail.
+    first_steps: >
+      Inspect the asset contents or asset_condition input and ensure each
+      element is serializable i.e. an  instance of SerializedAssetBase. If
+      assets are being dynamically constructed, verify they are properly
+      serialized before being passed. Avoid using raw identifiers or
+      unsupported data types, and instead use the appropriate Airflow asset
+      classes or serialization utilities.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/serializers.html
+
+  - error_code: AERR007
+    exception_type: TaskNotFound
+    user_facing_error_message: Requested task ID was not found in the DAG
+    description:
+      This error occurs when Airflow attempts to retrieve a task from the
+      DAG using a given task_id, but no matching entry exists in the internal
+      task_dict. It indicates that the specified task ID is either incorrect,
+      missing, or not registered as part of the DAG definition.
+    first_steps: >
+      Verify that the task_id is spelled correctly and matches exactly with
+      the task defined in the DAG (including case sensitivity). Check that the
+      task is properly instantiated and added to the DAG context. If the
+      task_id is dynamically generated, confirm the logic produces the
+      expected value. Also ensure that the DAG has been fully parsed and all
+      tasks are registered before attempting retrieval.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/tasks.html
+
+  - error_code: AERR008
+    exception_type: NodeNotFound
+    user_facing_error_message: Requested task label was not found in the DAG
+    description:
+      This error occurs when Airflow attempts to retrieve a task from the
+      DAG using a label, but no matching entry exists in the internal
+      task_dict. It indicates that the specified task label is either incorrect,
+      missing, or not registered as part of the DAG definition.
+    first_steps: >
+      Verify that the task label is spelled correctly and matches exactly with
+      the task defined in the DAG (including case sensitivity). Check that the
+      task is properly instantiated and added to the DAG context. If the
+      task label is dynamically generated, confirm the logic produces the
+      expected value. Also ensure that the DAG has been fully parsed and all
+      tasks are registered before attempting retrieval.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/tasks.html
+
+  - error_code: AERR009
+    exception_type: DagCodeNotFound
+    user_facing_error_message: DAG source code could not be found in metadata database
+    description: >
+      This error occurs when Airflow attempts to retrieve DAG source code
+      from the metadata database using a dag_id, but no matching DagCode
+      record exists. The lookup queries the latest stored DAG code entry
+      ordered by last_updated, and raises DagCodeNotFound when the query
+      returns no result. This usually indicates that the DAG has not yet
+      been serialized into the database, has been removed, or the dag_id
+      provided does not match any registered DAG code entry.
+    first_steps: >
+      Verify that the dag_id exists and matches the expected DAG exactly,
+      including case sensitivity. Confirm that the DAG file has been parsed
+      successfully by the scheduler and that DAG serialization or DAG code
+      persistence is functioning correctly. Check whether the DAG was recently
+      deleted, renamed, or excluded from parsing. Also inspect the dag_code
+      table in the Airflow metadata database to ensure the corresponding
+      source code entry is present.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/dag-serialization.html
+
+  - error_code: AERR010
+    exception_type: DagNotFound
+    user_facing_error_message: Requested DAG could not be found
+    description: >
+      This error occurs when Airflow attempts to perform a dry run operation
+      on a DAG but cannot locate the corresponding serialized DAG definition
+      in the metadata database. The system queries the latest serialized DAG
+      record for the provided dag_id, and raises DagNotFound when no matching
+      entry exists. This typically indicates that the DAG has not been parsed,
+      has not been serialized, has been deleted, or the dag_id provided does
+      not correspond to any known DAG in the system.
+    first_steps: >
+      Verify that the dag_id is correct and matches an existing DAG definition
+      exactly, including case sensitivity. Ensure that the DAG file is present
+      in the DAGs folder and has been successfully parsed by the scheduler.
+      Confirm that DAG serialization is enabled and functioning properly, and
+      that the SerializedDagModel table contains entries for the DAG. If the
+      DAG was recently added, allow time for the scheduler to pick it up and
+      serialize it.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/dags.html
+
+  - error_code: AERR011
+    exception_type: DagNotFound
+    user_facing_error_message: Requested DAG could not be found for backfill operation
+    description: >
+      This error occurs when Airflow attempts to create a backfill job for a
+      specified DAG but cannot locate its serialized definition in the metadata
+      database. The system queries the latest serialized DAG entry using the
+      provided dag_id, and raises DagNotFound when no corresponding record is
+      found. This indicates that the DAG is missing from the serialized DAG store,
+      has not been parsed or serialized yet, or the dag_id does not match any
+      registered DAG in the system.
+    first_steps: >
+      Verify that the dag_id is correct and matches an existing DAG definition
+      exactly, including case sensitivity. Ensure the DAG file is present in the
+      DAGs directory and has been successfully parsed by the scheduler. Confirm
+      that DAG serialization is enabled and that entries exist in the
+      SerializedDagModel table for the given DAG. If the DAG was recently added or
+      modified, allow time for the scheduler to process and serialize it before
+      retrying the backfill operation.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/dags.html
+
+  - error_code: AERR012
+    exception_type: PoolNotFound
+    user_facing_error_message: Pool deletion failed because the pool is either protected or does not exist
+    description: >
+      This error occurs when Airflow attempts to delete a pool but the operation
+      cannot be completed due to one of two conditions. If the requested pool is
+      the default pool, Airflow raises AirflowException because the default pool
+      is a protected system resource and cannot be removed. If the specified pool
+      name does not exist in the metadata database, PoolNotFound is raised. In both
+      cases, the deletion process is aborted before any database modification occurs.
+    first_steps: >
+      If the error is due to the default pool, verify that the pool name is not
+      "default_pool", as this pool is reserved and cannot be deleted. If the error
+      indicates PoolNotFound, confirm that the pool name is spelled correctly and
+      exists in the Airflow metadata database. You can list available pools via the
+      Airflow CLI or UI to validate existence before attempting deletion.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/pools.html
+
+  - error_code: AERR013
+    exception_type: DagNotFound
+    user_facing_error_message: Requested DAG could not be found for triggering a DAG run
+    description: >
+      This error occurs when Airflow attempts to trigger a DAG run but cannot
+      locate the latest version of the specified DAG within the DagBag or metadata
+      store. The system calls get_latest_version_of_dag(dag_id), and raises
+      DagNotFound when no matching DAG definition is found. This indicates that
+      the DAG is missing, not yet parsed, not included in the DAG bag, or the
+      dag_id does not correspond to any currently available DAG version.
+    first_steps: >
+      Verify that the dag_id is correct and matches an existing DAG definition
+      exactly, including case sensitivity. Ensure that the DAG file is present in
+      the DAGs directory and has been successfully parsed by the scheduler. Check
+      that the DAG is not paused or filtered out from the DagBag. If the DAG was
+      recently added or modified, confirm that the scheduler has reloaded it and
+      that it appears in the Airflow UI before retrying the trigger operation.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/dags.html
+
+  - error_code: AERR014
+    exception_type: DagNotFound
+    user_facing_error_message: Requested DAG could not be found in the DagModel registry
+    description: >
+      This error occurs when Airflow attempts to trigger a DAG run but cannot
+      locate the corresponding DAG entry in the DagModel table. The system raises
+      DagNotFound when no active or registered DAG record exists for the provided
+      dag_id. This indicates that the DAG is either not present in the metadata database,
+      has not been parsed and registered by the scheduler, or has been removed or renamed.
+    first_steps: >
+      Verify that the dag_id is correct and exactly matches an existing DAG
+      definition, including case sensitivity. Ensure the DAG file exists in the
+      configured DAGs folder and has been successfully parsed by the scheduler.
+      Check the Airflow UI or DagModel records in the metadata database to
+      confirm that the DAG is registered and active. If the DAG was recently
+      added or modified, allow time for scheduler parsing and metadata updates
+      before retrying the trigger operation.
+    documentation: >
+      https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/dags.html
+
+  - error_code: AERR015
+    exception_type: DagNotFound
+    user_facing_error_message: DAG deletion failed because active tasks exist or the DAG does not exist

Review Comment:
   If we're having error codes, we should have  two different error codes here as the description/steps for each is different.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3118457344


##########
airflow-core/src/airflow/exceptions.py:
##########
@@ -45,6 +45,23 @@
     class AirflowException(Exception):  # type: ignore[no-redef]
         """Base exception for Airflow errors."""
 
+    class AirflowEnumeratedException(Exception):

Review Comment:
   The problem with this approach is that we are explicitly moving _away_ from a base exception. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3118451641


##########
airflow-core/src/airflow/config_templates/error_mapping.yml:
##########


Review Comment:
   This file doesn't seem like a config template?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3213686420


##########
scripts/ci/prek/common_prek_utils.py:
##########
@@ -79,6 +79,50 @@ def temporary_tsc_project(
     yield temp_tsconfig_path
 
 
+def is_valid_python(contents: str) -> bool:
+    """
+    Checks if contents is valid python code or not.
+    args:
+        contents (str): Code contents.
+    returns: True if valid python code, False otherwise.
+    """
+    try:
+        compile(contents, "<string>", "exec")
+        return True
+    except SyntaxError:
+        return False
+
+
+@contextmanager
+def temporary_python_file(dir_path: Path, contents: str) -> Generator[_TemporaryFileWrapper, None, None]:

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3142240583


##########
airflow-core/src/airflow/exceptions.py:
##########
@@ -45,6 +45,23 @@
     class AirflowException(Exception):  # type: ignore[no-redef]
         """Base exception for Airflow errors."""
 
+    class AirflowEnumeratedException(Exception):

Review Comment:
   Nice, then I'll make this generic by supporting raises from any exception class, so any exception raised with an error_code will use error mapping. No AirflowEnumeratedException required (cc @potiuk in case you've any inputs here).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on PR #65423:
URL: https://github.com/apache/airflow/pull/65423#issuecomment-4418181437

   > tests are badly failing.
   
   For some reason, providers tests here in ci aren't using the new exception class signature (i.e. kwarg changes in this PR) as we see here: https://github.com/apache/airflow/actions/runs/25631489546/job/75238105874?pr=65423#step:12:10598
   
   But these tests succeed in local breeze when run with `breeze testing providers-tests`. @potiuk Any idea if I'm missing something?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #65423:
URL: https://github.com/apache/airflow/pull/65423#issuecomment-4490166282

   <!-- uv-lock-rebase-notice -->
   `uv.lock` on `main` just moved via [#67188](https://github.com/apache/airflow/pull/67188) ("Refresh uv.lock and Edge OpenAPI spec after #67093 env upgrade"), commit [`f9faf65`](https://github.com/apache/airflow/commit/f9faf65e34050de7f1b580bb6d0905c86a524ad5) and this PR currently conflicts.
   
   Quickest fix:
   ```bash
   git fetch upstream main && git rebase upstream/main
   rm uv.lock && uv lock
   git add uv.lock && git rebase --continue
   git push --force-with-lease
   ```
   
   _Automated nudge — ignore if you're not ready to rebase. This comment is updated in place on future `uv.lock` bumps._


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on PR #65423:
URL: https://github.com/apache/airflow/pull/65423#issuecomment-4572090118

   Closing this draft. As per discussion on devlist thread, we're not moving ahead with error codes for airflow exception classes and we'll likely focus on ensuring that our error descriptions are good.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss closed pull request #65423: Add error codes mapping with doc pages generation and static check
URL: https://github.com/apache/airflow/pull/65423


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3213679406


##########
airflow-core/.pre-commit-config.yaml:
##########
@@ -22,6 +22,20 @@ default_language_version:
   node: 22.19.0
   golang: 1.24.0
 repos:
+  - repo: local
+    hooks:
+      - id: check-error-code-in-exceptions
+        name: Check error_code usage in exceptions
+        entry: ../scripts/ci/prek/check_airflow_error_codes.py
+        language: python
+        files: >
+          (?x)
+          ^src/airflow/.*\.py$|

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on PR #65423:
URL: https://github.com/apache/airflow/pull/65423#issuecomment-4344903387

   As mentioned [above](https://github.com/apache/airflow/pull/65423#issuecomment-4320110812), have now added a few example error codes (AERR002 to AERR008) for existing exceptions' raises.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3161928664


##########
airflow-core/src/airflow/exceptions.py:
##########
@@ -45,6 +45,23 @@
     class AirflowException(Exception):  # type: ignore[no-redef]
         """Base exception for Airflow errors."""
 
+    class AirflowEnumeratedException(Exception):

Review Comment:
   Removed the enumerated base class and have added an error code mixin that can be used to raise exceptions with error_code. Have kept this mixin such that it doesn't alter the exception's data model and only includes the error code in its string representations, so when the exception in printed in Airflow logs the user will be able to see it and use for reporting etc.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3169985957


##########
airflow-core/docs/error_mapping.yml:
##########
@@ -0,0 +1,160 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+
+error_guide:
+  description: Quick debug guide for common errors while using Airflow.
+  error_codes:
+    # AERR001: Generic error, should only be raised as a catch-all error, if all else fails.

Review Comment:
   Thanks, looks like I'd missed that dev list discussion. Have updated PR, removed the generic error code for AirflowException.
   
   Yes for old ones in case someone needs, they can still add a new error code specific to their error case.
   
   And for new ones raising AirflowException looks to be blocked at prek, so we good there.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3213707355


##########
airflow-core/docs/error_mapping.yml:
##########
@@ -0,0 +1,149 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+
+error_guide:
+  description: Quick debug guide for common errors while using Airflow.
+  error_codes:
+    # Specify error codes below for exception classes as required.
+    # Exception class can have multiple error codes representing its respective error states.
+    # e.g. AirflowNotFoundException can have AERR001, AERR002, etc representing different not found cases.
+    - error_code: AERR001
+      exception_type: AirflowNotFoundException
+      user_facing_error_message: TaskSDK connection not found for requested connection ID
+      description: This error occurs when Airflow is unable to locate a connection
+        with given connection id in any configured secrets backend or metadata
+        store. It attempted to retrieve the connection via the Task SDK, but no
+        matching entry was found.
+      first_steps: Verify that the connection ID is correctly configured in Airflow.
+        Check your secrets backend, environment variables, or Airflow UI to
+        ensure the connection exists and is accessible to the current task.
+        Confirm there are no typos in the conn_id. If using a secrets backend,
+        ensure it is properly configured and reachable.
+      documentation: >
+        https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#using-connections
+
+    - error_code: AERR002
+      exception_type: AirflowNotFoundException
+      user_facing_error_message: Requested connection ID is not defined
+      description: This error occurs when Airflow attempts to resolve a connection
+        using its standard secrets resolution flow (SecretCache and configured
+        secrets backends) and is unable to find any matching connection for
+        given conn_id. It also indicates that all configured backends were
+        checked sequentially but none returned a valid connection.
+      first_steps: >
+        Confirm that the connection is defined in at least one configured
+        secrets backend or  in the Airflow metadata database. Check whether

Review Comment:
   Yes agreed, need to discuss the design thoroughly. YAML is definitely load bearing, it's only plus point seems that it's a very simple source of truth. I'll create a dev list thread for this discussion. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3213693675


##########
airflow-core/docs/error_mapping.yml:
##########
@@ -0,0 +1,149 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+
+error_guide:
+  description: Quick debug guide for common errors while using Airflow.
+  error_codes:
+    # Specify error codes below for exception classes as required.
+    # Exception class can have multiple error codes representing its respective error states.
+    # e.g. AirflowNotFoundException can have AERR001, AERR002, etc representing different not found cases.
+    - error_code: AERR001
+      exception_type: AirflowNotFoundException
+      user_facing_error_message: TaskSDK connection not found for requested connection ID
+      description: This error occurs when Airflow is unable to locate a connection
+        with given connection id in any configured secrets backend or metadata
+        store. It attempted to retrieve the connection via the Task SDK, but no
+        matching entry was found.
+      first_steps: Verify that the connection ID is correctly configured in Airflow.
+        Check your secrets backend, environment variables, or Airflow UI to
+        ensure the connection exists and is accessible to the current task.
+        Confirm there are no typos in the conn_id. If using a secrets backend,
+        ensure it is properly configured and reachable.
+      documentation: >
+        https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#using-connections
+
+    - error_code: AERR002
+      exception_type: AirflowNotFoundException
+      user_facing_error_message: Requested connection ID is not defined
+      description: This error occurs when Airflow attempts to resolve a connection
+        using its standard secrets resolution flow (SecretCache and configured
+        secrets backends) and is unable to find any matching connection for
+        given conn_id. It also indicates that all configured backends were
+        checked sequentially but none returned a valid connection.
+      first_steps: >
+        Confirm that the connection is defined in at least one configured
+        secrets backend or  in the Airflow metadata database. Check whether

Review Comment:
   I've updated PR to keep error_code embedded, so when the mixin is added to an exception class, now all instances of that exception class should mandatorily pass an error_code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3170100239


##########
airflow-core/src/airflow/models/connection.py:
##########
@@ -527,7 +527,9 @@ def get_connection_from_secrets(cls, conn_id: str, team_name: str | None = None)
                 return conn
             except AirflowRuntimeError as e:
                 if e.error.error == ErrorType.CONNECTION_NOT_FOUND:
-                    raise AirflowNotFoundException(f"The conn_id `{conn_id}` isn't defined") from None
+                    raise AirflowNotFoundException(
+                        f"The conn_id `{conn_id}` isn't defined", error_code="AERR002"

Review Comment:
   Initially I did keep error_code embedded in the exception, but with that devs will need to update for all old/existing raises for exception class.
   
   e.g. If dev uses error_code with `NodeNotFound`, there are two raises for it - in dag and task group. So 2 error codes will need to be defined for both raises respectively. And this may be a problem if dev has context only on one of those raises. And also if number of raises is too large (like AirflowBadRequest)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on PR #65423:
URL: https://github.com/apache/airflow/pull/65423#issuecomment-4413380127

   I've updated the PR as per changes suggested [in this comment](https://github.com/apache/airflow/pull/65423#pullrequestreview-4214977109) and resolved corresponding inline comments. Please have a look, thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3213680100


##########
task-sdk/src/airflow/sdk/exceptions.py:
##########
@@ -33,6 +33,26 @@
     from airflow.sdk.execution_time.comms import ErrorResponse
 
 
+class AirflowErrorCodeMixin:
+    """Mixin class providing ability to pass error_code to an exception."""
+
+    def __init__(self, *args, error_code=None, **kwargs):
+        self.error_code = error_code
+        super().__init__(*args, **kwargs)
+
+    def __str__(self):
+        base = super().__str__()
+        if self.error_code is None:
+            return base
+        error_code_str = f"[airflow error code={self.error_code}]"

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3217817574


##########
airflow-core/docs/error_mapping.yml:
##########
@@ -0,0 +1,149 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+
+error_guide:
+  description: Quick debug guide for common errors while using Airflow.
+  error_codes:
+    # Specify error codes below for exception classes as required.
+    # Exception class can have multiple error codes representing its respective error states.
+    # e.g. AirflowNotFoundException can have AERR001, AERR002, etc representing different not found cases.
+    - error_code: AERR001
+      exception_type: AirflowNotFoundException
+      user_facing_error_message: TaskSDK connection not found for requested connection ID
+      description: This error occurs when Airflow is unable to locate a connection
+        with given connection id in any configured secrets backend or metadata
+        store. It attempted to retrieve the connection via the Task SDK, but no
+        matching entry was found.
+      first_steps: Verify that the connection ID is correctly configured in Airflow.
+        Check your secrets backend, environment variables, or Airflow UI to
+        ensure the connection exists and is accessible to the current task.
+        Confirm there are no typos in the conn_id. If using a secrets backend,
+        ensure it is properly configured and reachable.
+      documentation: >
+        https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#using-connections
+
+    - error_code: AERR002
+      exception_type: AirflowNotFoundException
+      user_facing_error_message: Requested connection ID is not defined
+      description: This error occurs when Airflow attempts to resolve a connection
+        using its standard secrets resolution flow (SecretCache and configured
+        secrets backends) and is unable to find any matching connection for
+        given conn_id. It also indicates that all configured backends were
+        checked sequentially but none returned a valid connection.
+      first_steps: >
+        Confirm that the connection is defined in at least one configured
+        secrets backend or  in the Airflow metadata database. Check whether

Review Comment:
   @potiuk Also, past discussion from Dec 2024 - https://lists.apache.org/thread/k3dxc6lmrwvqgmvjr9x53poswwpoo5o8. Hoping to get some responses from folks this time 😅🤞🏽 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3142258449


##########
airflow-core/src/airflow/config_templates/error_mapping.yml:
##########


Review Comment:
   Yep it's not a config template. Could you suggest a better location for this error mapping yml file?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on code in PR #65423:
URL: https://github.com/apache/airflow/pull/65423#discussion_r3142257093


##########
airflow-core/docs/contributor/error_codes/AERR001.rst:
##########


Review Comment:
   Yes its a generated one, removed from git. Thanks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add error codes mapping with doc pages generation and static check [airflow]

Posted by "omkar-foss (via GitHub)" <gi...@apache.org>.
omkar-foss commented on PR #65423:
URL: https://github.com/apache/airflow/pull/65423#issuecomment-4520394026

   Keep this as draft until we've a decision over doc strings on the devlist thread: https://lists.apache.org/thread/j0nn52pqlz4sfm6zfoz786t0yrl9xczn


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org