inspect_instances fails the entire list when one instance has malformed metadata
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start in crates/driver/src/inspect/installed.rs at InstalledInstance::detect_all, where the ? inside the loop aborts the scan, then follow InstanceProbe::collect in crates/driver/src/inspect/probe.rs and the wrapper Launcher::inspect_instances in crates/launcher/src/launcher.rs. Done means one malformed instance no longer hides the others and each failure carries the instance name or path; the API shape (report struct or per-item Result) needs a maintainer decision first, and inspect_instance(name) stays fail-fast.
Written by the indexing model from the issue text.
Description
Summary
Launcher::inspect_instances() is all-or-nothing. A single unreadable or malformed instance metadata file makes the whole call return Err, so callers cannot list the remaining healthy instances or identify which instance is broken.
Where
-
crates/launcher/src/launcher.rs:114—Launcher::inspect_instancescollectsResult<Vec<InstalledInstance>>. -
crates/driver/src/inspect/installed.rs:43—InstalledInstance::detect_alluses?inside the loop:for instance in storage.instances(version_layout)? { if let Some(installed) = Self::detect(instance, drivers).await? { instances.push(installed); } } -
crates/driver/src/inspect/probe.rs:23—InstanceProbe::collectopens and parses the version JSON:Ok(serde_json::from_reader(File::open(path)?)?)
A truncated or invalid <version>.json, an unreadable file, or a read_dir failure aborts the whole scan.
Impact
A launcher UI typically calls inspect_instances to render the installed-instance list. One corrupt instance file in .minecraft/versions hides every other instance. The user cannot select a healthy instance, nor see which entry needs repair or removal. The returned error also has no instance name or path attached, so the caller cannot tell which directory caused it.
Reproduction
- Create two valid instances (
a,b). - Truncate or corrupt
versions/a/a.json(or otherwise make it invalid JSON). - Call
Launcher::inspect_instances().await. - Observe
Err(...);bis not returned.
Proposal
Make the aggregate scan report per-instance failures instead of aborting, for example:
pub struct InspectReport {
pub instances: Vec<Instance>,
pub failures: Vec<InstanceInspectionFailure>,
}
pub struct InstanceInspectionFailure {
pub instance_name: String,
pub path: PathBuf,
pub error: Error,
}
Alternatively, return Vec<Result<Instance, InstanceInspectionError>>. The important part is that one bad instance does not hide the rest, and the failure includes the instance name or path. Skipping invalid entries with only a log is less useful for a UI that wants to offer repair or delete actions.
inspect_instance(name) can remain fail-fast because it targets one known instance.
Version
main at b4d6e84.
- Dominant language
- Rust
- Stars
- 11
- Forks
- 1
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 52
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ElectronicWave/Elemental
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ElectronicWave/Elemental#265 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
ElectronicWave/Elemental#261 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
ElectronicWave/Elemental#266 ·
Maintainers usually reply within 1 day
-
docs: CommentsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 34/100
ElectronicWave/Elemental#230 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 38/100
ElectronicWave/Elemental#227 · 1 comment ·
Maintainers usually reply within 1 day
All issues in ElectronicWave/Elemental
Similar issues
-
area:ui bug effort:low P2 source:agent
Difficulty 1/5 Under an hour Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
akitaonrails/ai-memory#2314 ·
Maintainers usually reply within 1 day
-
bug priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
nledford/Ladderback#809 ·
Maintainers usually reply within 1 day
-
bug low-priority
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
dividebysandwich/rust-dos#1170 ·
Maintainers usually reply within 1 day
-
area:cli area:security bug priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day