winstonjs/winston · error · Error
{ colors, emitErrs, formatters, padLevels, rewriters, stripC
Error message
{ colors, emitErrs, formatters, padLevels, rewriters, stripColors } were removed in winston@3.0.0.
Use a custom winston.format(function) instead.
See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md What it means
In winston 3, `logger.configure(options)` rejects the removed winston 2.x options — `colors`, `emitErrs`, `formatters`, `padLevels`, `rewriters`, `stripColors`. This also fires via the Logger constructor, which delegates to configure. The rewrite moved all message shaping into the `winston.format` pipeline, so these legacy options are treated as a hard configuration error with a pointer to the upgrade guide.
Source
Thrown at lib/winston/logger.js:137
this.rejections = new RejectionHandler(this);
this.profilers = {};
this.exitOnError = exitOnError;
// Add all transports we have been provided.
if (transports) {
transports = Array.isArray(transports) ? transports : [transports];
transports.forEach(transport => this.add(transport));
}
if (
colors ||
emitErrs ||
formatters ||
padLevels ||
rewriters ||
stripColors
) {
throw new Error(
[
'{ colors, emitErrs, formatters, padLevels, rewriters, stripColors } were removed in winston@3.0.0.',
'Use a custom winston.format(function) instead.',
'See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md'
].join('\n')
);
}
if (exceptionHandlers) {
this.exceptions.handle(exceptionHandlers);
}
if (rejectionHandlers) {
this.rejections.handle(rejectionHandlers);
}
}
/**
* Helper method to get the highest logging level associated with a loggerView on GitHub (pinned to ff0b79de85)
Solutions
- Delete the removed options from the config object.
- Move level/`colors` customization to `winston.addColors(colors)` and level sets via the `levels` option.
- Replace formatters/rewriters/stripColors/padLevels with `winston.format.combine(...)` including `format.colorize()`, `format.padLevels()`, `format.printf()`, or a custom `winston.format(fn)`.
- Remove `emitErrs` and handle transport errors via the logger/transport `error` event instead.
- Follow UPGRADE-3.0.md for a per-option mapping.
Example fix
// before (winston 2.x)
const logger = new winston.Logger({
colors: { info: 'blue' },
padLevels: true,
rewriters: [(level, msg, meta) => meta]
});
// after (winston 3.x)
winston.addColors({ info: 'blue' });
const logger = winston.createLogger({
format: winston.format.combine(
winston.format.colorize(),
winston.format.padLevels()
),
transports: [new winston.transports.Console()]
}); Defensive patterns
Strategy: validation
Validate before calling
const REMOVED = ['colors', 'emitErrs', 'formatters', 'padLevels', 'rewriters', 'stripColors'];
const bad = REMOVED.filter(k => k in loggerOptions);
if (bad.length) throw new TypeError(`Removed winston 2.x options: ${bad.join(', ')} — migrate to winston.format`); Try / catch
try {
logger.configure(opts);
} catch (err) {
if (err.message.includes('were removed in winston@3.0.0')) {
const { colors, ...rest } = opts;
if (colors) winston.addColors(colors);
logger.configure(rest);
} else { throw err; }
} Prevention
- Sanitize config objects loaded from JSON/files against a winston 3 schema
- Replace v2 option names during migration using UPGRADE-3.0.md as a checklist
- Construct the logger once in a dedicated module so legacy options surface in tests
- Keep wrapper libraries' option passthrough updated to the winston 3 surface
When it happens
Trigger: Passing any of `{ colors, emitErrs, formatters, padLevels, rewriters, stripColors }` in the options object to `new winston.Logger({...})` or `logger.configure({...})` — e.g. `new winston.Logger({ colors: {...} })` or `configure({ rewriters: [...] })`.
Common situations: Direct winston 2.x -> 3.x migration where the old logger options object is reused; config files loaded from JSON containing v2 option names; frameworks or wrappers that still emit v2-style logger options.
Related errors
- { %s } was removed in winston@3.0.0. Use a custom winston.fo
- Logger.cli() was removed in winston@3.0.0 Use a custom winst
- { %s } was removed in winston@3.0.0.
- Callback function no longer supported as of winston@3.0.0
- winston: exitOnError cannot be true with no rejection handle
AI-assisted analysis of winstonjs/winston@ff0b79de85 (2026-08-31).
Data as JSON: /api/errors/8ce62ec89890ed49.
Report an issue: GitHub.