From 41934a33e6b52d73df90f936768e2caa4e28dbaf Mon Sep 17 00:00:00 2001 From: harshitha-cstk Date: Tue, 18 Aug 2026 13:20:30 +0530 Subject: [PATCH 1/2] fix(bulk-operations): surface errors on console when console logs are off MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bulk command failures were silently swallowed when log.showConsoleLogs was disabled — handleAndLogError only reaches the console through the winston error transport, which is silenced in that mode, so the terminal showed nothing on failure (e.g. an invalid stack API key). Print a user-facing error line in BaseBulkCommand.catch() when console logs are off, reusing cliErrorHandler.classifyError so the message matches the friendly text written to the log file. Guarded to avoid double-printing when console logs are on. Ref: DX-10224 Co-Authored-By: Claude Opus 4.8 --- .../src/base-bulk-command.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/contentstack-bulk-operations/src/base-bulk-command.ts b/packages/contentstack-bulk-operations/src/base-bulk-command.ts index 3251e19ab..1eaa5560e 100644 --- a/packages/contentstack-bulk-operations/src/base-bulk-command.ts +++ b/packages/contentstack-bulk-operations/src/base-bulk-command.ts @@ -5,6 +5,8 @@ import { createLogContext, getLogPath, handleAndLogError, + cliErrorHandler, + cliux, FlagInput, getChalk, loadChalk, @@ -663,13 +665,19 @@ export abstract class BaseBulkCommand extends Command { * This includes errors during init, run, and other phases */ async catch(error: Error): Promise { - // Check if this is a DisplayedError (should be shown to user) - // if (error.name === 'DisplayedError') { - // process.exit(1); - // } - // For other errors, use the CLI utilities error handler handleAndLogError(error); + + // handleAndLogError only reaches the console when log.showConsoleLogs is enabled + // (the winston error transport is silenced otherwise), so a failure would leave the + // terminal completely silent when the user has console logs turned off. Print a + // user-facing error line here to fill that gap, guarded so we don't double-print when + // console logs are on and handleAndLogError already emitted the error. + const showConsoleLogs = Boolean(configHandler.get('log')?.showConsoleLogs); + if (!showConsoleLogs) { + const friendlyMessage = cliErrorHandler.classifyError(error)?.message || error?.message || 'Unknown error'; + cliux.print(`Error: ${friendlyMessage}`, { color: 'red' }); + } } abstract run(): Promise; From 0a6dec4c1b1e794eba4c98c4b0f0ff7bcc558e7c Mon Sep 17 00:00:00 2001 From: harshitha-cstk Date: Tue, 18 Aug 2026 15:16:43 +0530 Subject: [PATCH 2/2] update error msg --- .../contentstack-bulk-operations/src/base-bulk-command.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/contentstack-bulk-operations/src/base-bulk-command.ts b/packages/contentstack-bulk-operations/src/base-bulk-command.ts index 1eaa5560e..594f48819 100644 --- a/packages/contentstack-bulk-operations/src/base-bulk-command.ts +++ b/packages/contentstack-bulk-operations/src/base-bulk-command.ts @@ -675,8 +675,8 @@ export abstract class BaseBulkCommand extends Command { // console logs are on and handleAndLogError already emitted the error. const showConsoleLogs = Boolean(configHandler.get('log')?.showConsoleLogs); if (!showConsoleLogs) { - const friendlyMessage = cliErrorHandler.classifyError(error)?.message || error?.message || 'Unknown error'; - cliux.print(`Error: ${friendlyMessage}`, { color: 'red' }); + const errorMessage = cliErrorHandler.classifyError(error)?.message || error?.message || 'Unknown error'; + cliux.print(`Error: ${errorMessage}`, { color: 'red' }); } }