Skip to content

[Nightly] anolisa list 命令失败:components-v2.toml HTTP 404 #2562

Description

@zhangtaibo

Component

anolisa

Bug Description

The anolisa list command fails with exit code 1 and stderr failed to load component index: failed to fetch component index: failed to fetch http://mirrors.cloud.aliyuncs.com/anolisa/generic/anolisa/v1/components-v2.toml: http status 404 while fetching http://mirrors.cloud.aliyuncs.com/anolisa/generic/anolisa/v1/components-v2.toml.

The root cause is in src/anolisa/crates/anolisa-cli/src/resolution.rs:741 where load_component_index() calls component_index_v2_url(&base_url) which constructs the URL {base_url}/v1/components-v2.toml. This file does not exist on the mirror server (HTTP 404), but the function hard-fails instead of gracefully degrading. The v1 file components.toml is available at HTTP 200.

Introduced by commit 52fa3159 (2026-08-14, author: 爱鲲) which switched list to read components-v2.toml (schema v2) but the mirror was never deployed with this file.

Steps to Reproduce

  1. Install anolisa 0.3.1 on any Anolis host
  2. Run anolisa list
  3. Observe exit code 1 with stderr about HTTP 404 fetching components-v2.toml

Actual Behavior

error: failed to load component index: failed to fetch component index: failed to fetch http://mirrors.cloud.aliyuncs.com/anolisa/generic/anolisa/v1/components-v2.toml: http status 404 while fetching http://mirrors.cloud.aliyuncs.com/anolisa/generic/anolisa/v1/components-v2.toml

Exit code: 1. The list command is completely non-functional for all users.

Expected Behavior

anolisa list should return exit code 0 and display the component listing table. Per resolution.rs:720-756, load_component_index should either:

  • Fallback to v1 components.toml when v2 is unavailable, or
  • Return an empty index gracefully so list works with just local installed state

Root Cause

File: src/anolisa/crates/anolisa-cli/src/resolution.rs:750-754

The cache.fetch(&url, None) call at line 750 propagates the HTTP 404 error via map_err + ?, causing list to hard-fail. The fix is to catch the fetch error and return an empty ComponentIndex (graceful degradation) so the command still works when the mirror hasn't deployed v2 yet.

Regression introduced by commit 52fa3159 (fix(anolisa): check target architecture, 2026-08-14 13:58).

Suggested Fix

Replace the hard-fail cache.fetch(&url, None).map_err(...)? at resolution.rs:750-754 with a match that returns an empty ComponentIndex on fetch failure:

// Graceful degradation: if v2 index is unavailable (e.g., mirror not yet
// deployed), return an empty index instead of failing `list` entirely.
let downloaded = match cache.fetch(&url, None) {
    Ok(d) => d,
    Err(_) => {
        return Ok(ComponentIndex {
            schema_version: COMPONENT_INDEX_SCHEMA_VERSION,
            generated_at: None,
            publisher: None,
            components: Vec::new(),
        });
    }
};

Environment

  • OS: Anolis OS 23 (alnx4)
  • Component: anolisa
  • Package version: anolisa-0.3.1-1.alnx4.x86_64
  • Mirror: mirrors.cloud.aliyuncs.com
  • Nightly run: nightly-20260814-170909
  • ECS: 8.217.123.80

Metadata

Metadata

Labels

component:anolisasrc/anolisapriority:p1High: blocks the current release or key user experiencetype:bugA confirmed defect or incorrect behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions