bevyengine/bevy · error · ParseAssetPathError
Asset source must not contain a `#` character
Error message
Asset source must not contain a `#` character
What it means
ParseAssetPathError::InvalidSourceSyntax: while parsing an asset path string, the source section (the part before ://) contained the label delimiter '#' (e.g. 'bad#source://file.test'). The source name must be a plain identifier without '#'.
Source
Thrown at crates/bevy_asset/src/path.rs:86
impl<'a> Display for AssetPath<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
if let AssetSourceId::Name(name) = self.source() {
write!(f, "{name}://")?;
}
write!(f, "{}", self.path.display())?;
if let Some(label) = &self.label {
write!(f, "#{label}")?;
}
Ok(())
}
}
/// An error that occurs when parsing a string type to create an [`AssetPath`] fails, such as during [`AssetPath::parse`].
#[derive(Error, Debug, PartialEq, Eq)]
pub enum ParseAssetPathError {
/// Error that occurs when the [`AssetPath::source`] section of a path string contains the [`AssetPath::label`] delimiter `#`. E.g. `bad#source://file.test`.
#[error("Asset source must not contain a `#` character")]
InvalidSourceSyntax,
/// Error that occurs when the [`AssetPath::label`] section of a path string contains the [`AssetPath::source`] delimiter `://`. E.g. `source://file.test#bad://label`.
#[error("Asset label must not contain a `://` substring")]
InvalidLabelSyntax,
/// Error that occurs when a path string has an [`AssetPath::source`] delimiter `://` with no characters preceding it. E.g. `://file.test`.
#[error("Asset source must be at least one character. Either specify the source before the '://' or remove the `://`")]
MissingSource,
/// Error that occurs when a path string has an [`AssetPath::label`] delimiter `#` with no characters succeeding it. E.g. `file.test#`
#[error("Asset label must be at least one character. Either specify the label after the '#' or remove the '#'")]
MissingLabel,
}
impl<'a> AssetPath<'a> {
/// Creates a new [`AssetPath`] from a string in the asset path format:
/// * An asset at the root: `"scene.gltf"`
/// * An asset nested in some folders: `"some/path/scene.gltf"`
/// * An asset with a "label": `"some/path/scene.gltf#Mesh0"`
/// * An asset with a custom "source": `"custom://some/path/scene.gltf#Mesh0"`View on GitHub (pinned to 8d743eb7dc)
Solutions
- Remove the '#' from the asset source name in the path string
- Move any label to the end of the path after a single '#'
- Escape or rename source names that legitimately contain special characters
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/bevy_asset/src/path.rs:86 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of bevyengine/bevy@8d743eb7dc (2026-08-20).
Data as JSON: /api/errors/599b9eafe2dae7c1.
Report an issue: GitHub.