Skip to content

Improve error message when config file loading fails in API server #1839

@coderabbitai

Description

@coderabbitai

Description

The error message when loading the config file in the API server is misleading. It currently says "Config file {path} does not exist", but the actual failure can be due to multiple reasons, including YAML schema mismatches.

Example

When there's a YAML schema mismatch, the error message is:

Error: Config file /etc/clp-config.yaml does not exist

Caused by:
    0: `serde_yaml::Error`: stream_output: unknown variant `profile`, expected `credentials` at line 85 column 3
    1: stream_output: unknown variant `profile`, expected `credentials` at line 85 column 3

The file exists, but the schema is invalid. The message should be more generic, such as "Failed to load config file" to avoid confusion.

Location

components/api-server/src/bin/api_server.rs lines 31-33

Related Links

Requested by: @junhaoliao

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions