slint-ui/slint · error · std::io::Error
is still loading
Error message
{path:?} is still loading What it means
drop_document removes a compiled document and its registry entry, but refuses to do so while the compiler is still asynchronously loading that path (currently_loading map). Dropping would corrupt the loading pipeline's bookkeeping, so it returns an InvalidInput io::Error instead.
Solutions
- Wait until the pending load completes (or fails) before calling drop_document.
- Cancel or drain the in-flight load first; drop_document again after currently_loading no longer contains the path.
- Ignore the error and retry later — the document is left intact.
Example fix
// before
loader.drop_document(&path).unwrap();
// after
match loader.drop_document(&path) {
Ok(deps) => { /* proceed */ }
Err(e) if e.kind() == std::io::ErrorKind::InvalidInput => {
// still loading; retry after the load future resolves
}
Err(e) => return Err(e.into()),
} Defensive patterns
Strategy: try-catch
Validate before calling
// guard: only drop when not currently loading
if !loader.all_documents.currently_loading.contains_key(path) { loader.drop_document(path)?; } Try / catch
match loader.drop_document(&path) {
Ok(deps) => /* proceed */,
Err(e) if e.kind() == ErrorKind::InvalidInput => /* retry after load completes */,
Err(e) => return Err(e.into()),
} Prevention
- Track in-flight loads in your editor integration and defer drop_document until they resolve.
- Serialize document mutations (load/drop) through one event loop to avoid races.
When it happens
Trigger: Calling TypeLoader::drop_document(path) while a load/future for that same path is in flight (path is in self.all_documents.currently_loading).
Common situations: Hot-reload or LSP flows where a file change triggers reload while the previous load's async I/O hasn't finished; user closes/edits a document faster than the compiler resolves imports.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- a setter belongs to a field
- an identifier
- Component should cleanly upgrade here
- Components written in Rust can not get embedded yet.
- constraint must have binding
AI-assisted analysis of slint-ui/slint@3a7e700487 (2026-09-16).
Data as JSON: /api/errors/a779f6b3dca1b9d4.
Report an issue: GitHub.
Appendix: source
Thrown at internal/compiler/typeloader.rs:1018
self.revision = self.revision.wrapping_add(1);
}
pub fn revision(&self) -> u64 {
self.revision
}
/// Drop a document from the TypeLoader and invalidate all of its dependencies.
/// Returns the list of all (transitive) dependencies.
///
/// This forces the compiler to entirely reload the document from scratch.
/// To only cause a re-analyze, but not a reparse, use [Self::invalidate_document]
pub fn drop_document(&mut self, path: &Path) -> Result<HashSet<PathBuf>, std::io::Error> {
let dependencies = self.invalidate_document(path);
self.all_documents.docs.remove(path);
self.bump_revision();
if self.all_documents.currently_loading.contains_key(path) {
Err(std::io::Error::new(ErrorKind::InvalidInput, format!("{path:?} is still loading")))
} else {
Ok(dependencies)
}
}
/// Invalidate a document and all its dependencies.
///
/// This will keep the CST of the document in cache, but mark that it needs to be re-analyzed
/// to reconstruct its types.
///
/// To entirely forget a document and cause a complete re-parse, use [Self::drop_document].
pub fn invalidate_document(&mut self, path: &Path) -> HashSet<PathBuf> {
if let Some((d, _)) = self.all_documents.docs.get_mut(path) {
if let LoadedDocument::Document(doc) = d {
for import in &doc.imports {
self.all_documents
.dependencies
.entry(Path::new(&import.file).into())View on GitHub (pinned to 3a7e700487)