Closed
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.errorsIssues and PRs related to JavaScript errors originating in Node.js core.Issues and PRs related to JavaScript errors originating in Node.js core.
Description
Version
v26.4.0
Platform
Linux archbtw 7.1.3-arch2-2 #1 SMP PREEMPT_DYNAMIC Thu, 16 Jul 2026 17:41:28 +0000 x86_64 GNU/Linux
Subsystem
Crypto
What steps will reproduce the bug?
let key = scryptSync('hello', 'salt', 24)
let init_vector = randomFillSync(new Uint8Array(16))
const cipher = createCipheriv('aes-192-cbc', key, init_vector);
let encrypted = cipher.update('some clear text data', 'utf8', 'hex');
encrypted += cipher.final('utf8');What is the expected behavior? Why is that the expected behavior?
The error should be handled gracefully and reported to the user.
What do you see instead?
Uncaught Error [ERR_INTERNAL_ASSERTION]: Cannot change encoding
This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
at assert.fail (node:internal/assert:17:9)
at getDecoder (node:internal/crypto/cipher:101:12)
at Cipheriv.final (node:internal/crypto/cipher:175:21) {
code: 'ERR_INTERNAL_ASSERTION'
Metadata
Metadata
Assignees
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.errorsIssues and PRs related to JavaScript errors originating in Node.js core.Issues and PRs related to JavaScript errors originating in Node.js core.
Activity
Archkon commentedon Jul 23, 2026
[-]ERR_INTERNAL_ASSERTION[/-][+]Passing different encodings to Cipheriv updates results in ERR_INTERNAL_ASSERTION[/+]crypto: use user-facing error for output encoding changes
crypto: use user-facing error for output encoding changes
crypto: use user-facing error for output encoding changes
crypto: use user-facing error for output encoding changes