streamlit/streamlit · error · StreamlitComponentRegistryError

{kind} path '{abs_path}' is outside the declared asset_dir '

Error message

{kind} path '{abs_path}' is outside the declared asset_dir '{root}'.

What it means

Error "{kind} path '{abs_path}' is outside the declared asset_dir '{root}'." thrown in streamlit/streamlit.

Source

Thrown at lib/streamlit/components/v2/component_path_utils.py:191

            Human-readable descriptor for error messages (e.g., "js" or "css")

        Raises
        ------
        StreamlitComponentRegistryError
            If the path cannot be resolved or if the resolved path does not
            reside within ``root`` after following symlinks.
        """
        try:
            resolved = abs_path.resolve()
            root_resolved = root.resolve()
        except Exception as e:
            raise StreamlitComponentRegistryError(
                f"Failed to resolve {kind} path '{abs_path}': {e}"
            ) from e

        # Use Path.is_relative_to to avoid insecure prefix-based checks
        if not resolved.is_relative_to(root_resolved):
            raise StreamlitComponentRegistryError(
                f"{kind} path '{abs_path}' is outside the declared asset_dir '{root}'."
            )

    @staticmethod
    def looks_like_inline_content(value: str) -> bool:
        r"""Heuristic to detect inline JS/CSS content strings.

        Treat a string as a file path ONLY if it looks path-like:
        - Does not contain newlines
        - Contains glob characters (*, ?, [, ])
        - Starts with ./, /, or \
        - Contains a path separator ("/" or "\\")
        - Or ends with a common asset extension like .js, .mjs, .cjs, or .css

        Otherwise, treat it as inline content.

        Parameters
        ----------

View on GitHub (pinned to 202661fc55)

When it happens

Trigger: Thrown at lib/streamlit/components/v2/component_path_utils.py:191 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of streamlit/streamlit@202661fc55 (2026-08-26). Data as JSON: /api/errors/3e413475726453e4. Report an issue: GitHub.