fix(config): name the rejected setting and its constraint in configuration errors
Every configuration failure projected the same message, "REA configuration is invalid. Run `rea doctor` and fix the reported setting.", with no details. The environment parser discarded the issue that names the variable (for example `REA_GHIDRA_NATIVEAOT_JAR must be absolute`), and doctor can report healthy for that environment, so neither the CLI, the MCP startup message, nor doctor told callers which setting to correct. ConfigurationError now carries the rejected settings and their constraints (never their values). The projection names them in its message, lists them in `details.settings`, and asks the caller to correct those settings where REA is started. Errors without a named setting keep the previous message. Fixes #1184 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e6abaefbbc
commit
0a0244db42
@@ -78,6 +78,8 @@ export const analysisErrorRemediationAction = (
|
||||
return "Check the current process's read access to the selected path. Retry with a readable local file.";
|
||||
if (error instanceof AnalysisArtifactChangedError)
|
||||
return "Wait until the selected file is stable. For an active binary session, reopen the target with open_binary before retrying so REA acquires its current identity; for a CLI command or target-free tool, rerun the operation.";
|
||||
if (error instanceof ConfigurationError && error.settings.length > 0)
|
||||
return `Correct ${[...new Set(error.settings.map(({ setting }) => setting))].join(", ")} in the environment that starts REA (your shell or the MCP client's registration), then rerun.`;
|
||||
if (error instanceof AnalysisInputError)
|
||||
return "Correct the listed arguments and retry.";
|
||||
if (error instanceof UnknownRegistryError && error.reason === "not-found")
|
||||
@@ -189,7 +191,15 @@ export const analysisErrorUserMessage = (error: AnalysisError): string => {
|
||||
if (error instanceof UnknownRegistryError)
|
||||
return "Evidence state changed before the update completed. Refresh the current state and try again.";
|
||||
if (error instanceof ConfigurationError)
|
||||
return "REA configuration is invalid. Run `rea doctor` and fix the reported setting.";
|
||||
return error.settings.length === 0
|
||||
? "REA configuration is invalid. Run `rea doctor` and fix the reported setting."
|
||||
: `REA configuration is invalid: ${error.settings
|
||||
.map(({ setting, constraint }) =>
|
||||
constraint.includes(setting)
|
||||
? constraint.replace(/\.$/u, "")
|
||||
: `${setting}: ${constraint}`,
|
||||
)
|
||||
.join("; ")}.`;
|
||||
if (error instanceof NoBinaryOpenError) return error.message;
|
||||
if (error instanceof BinaryTargetError)
|
||||
return error.constraint === "directory_requires_file"
|
||||
|
||||
Reference in New Issue
Block a user