Skip to content

Commit efaa916

Browse files
lengmodkxclaude
andauthored
fix: prevent [object Object] error display in console output (anomalyco#8116)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent eb20449 commit efaa916

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎packages/opencode/src/cli/cmd/debug/file.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const FileTreeCommand = cmd({
7878
}),
7979
async handler(args) {
8080
const files = await Ripgrep.tree({ cwd: args.dir, limit: 200 })
81-
console.log(files)
81+
console.log(JSON.stringify(files, null, 2))
8282
},
8383
})
8484

‎packages/opencode/src/cli/cmd/github.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ export const GithubRunCommand = cmd({
624624
}
625625
} catch (e: any) {
626626
exitCode = 1
627-
console.error(e)
627+
console.error(e instanceof Error ? e.message : String(e))
628628
let msg = e
629629
if (e instanceof $.ShellError) {
630630
msg = e.stderr.toString()
@@ -915,7 +915,7 @@ export const GithubRunCommand = cmd({
915915

916916
// result should always be assistant just satisfying type checker
917917
if (result.info.role === "assistant" && result.info.error) {
918-
console.error(result.info)
918+
console.error("Agent error:", result.info.error)
919919
throw new Error(
920920
`${result.info.error.name}: ${"message" in result.info.error ? result.info.error.message : ""}`,
921921
)
@@ -944,7 +944,7 @@ export const GithubRunCommand = cmd({
944944
})
945945

946946
if (summary.info.role === "assistant" && summary.info.error) {
947-
console.error(summary.info)
947+
console.error("Summary agent error:", summary.info.error)
948948
throw new Error(
949949
`${summary.info.error.name}: ${"message" in summary.info.error ? summary.info.error.message : ""}`,
950950
)
@@ -962,7 +962,7 @@ export const GithubRunCommand = cmd({
962962
try {
963963
return await core.getIDToken("opencode-github-action")
964964
} catch (error) {
965-
console.error("Failed to get OIDC token:", error)
965+
console.error("Failed to get OIDC token:", error instanceof Error ? error.message : error)
966966
throw new Error(
967967
"Could not fetch an OIDC token. Make sure to add `id-token: write` to your workflow permissions.",
968968
)

‎packages/opencode/src/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ try {
147147
if (formatted) UI.error(formatted)
148148
if (formatted === undefined) {
149149
UI.error("Unexpected error, check log file at " + Log.file() + " for more details" + EOL)
150-
console.error(e)
150+
console.error(e instanceof Error ? e.message : String(e))
151151
}
152152
process.exitCode = 1
153153
} finally {

0 commit comments

Comments
 (0)