javascript Errors

286 error patterns

javascript3 fixes

Cannot read property of undefined

Cannot read propert(y|ies) of undefined

  • Add optional chaining (?.)
  • Check if object exists before accessing
javascript3 fixes

Cannot read property of null

Cannot read propert(y|ies) of null

  • Add null check before access
  • Use optional chaining (?.)
javascript3 fixes

TypeError: X is not a function

is not a function

  • Check spelling of method name
  • Verify import is correct
javascript3 fixes

ReferenceError: X is not defined

is not defined

  • Import or declare the variable
  • Check for typos in variable name
javascript3 fixes

TypeError: Assignment to constant variable

Assignment to constant variable

  • Use let instead of const
  • Create new variable for modified value
javascript3 fixes

TypeError: Cannot assign to read only property

Cannot assign to read only property

  • Clone object before modifying with spread or structuredClone
  • Use Object.defineProperty with writable:true
javascript3 fixes

RangeError: Maximum call stack size exceeded

Maximum call stack size exceeded

  • Add base case to recursive function
  • Convert recursion to iteration
javascript3 fixes

SyntaxError: Unexpected token

Unexpected token

  • Check for missing commas or brackets
  • Verify JSON format is valid
javascript3 fixes

SyntaxError: Unexpected end of input

Unexpected end of (input|JSON)

  • Check for unclosed brackets or quotes
  • Verify complete JSON response
javascript3 fixes

Cannot use import statement outside a module

Cannot use import statement outside a module

  • Add type="module" to script tag
  • Set "type":"module" in package.json
javascript3 fixes

TypeError: X is not iterable

is not iterable

  • Ensure value is array or has Symbol.iterator
  • Convert to array with Array.from()
javascript3 fixes

Cannot destructure property of undefined/null

Cannot destructure property .* of .* as it is (undefined|null)

  • Provide default value in destructuring
  • Add null check before destructuring
javascript3 fixes

TypeError: Reduce of empty array with no initial value

Reduce of empty array with no initial value

  • Provide initial value as second argument to reduce()
  • Check array length before reducing
javascript3 fixes

TypeError: Cannot convert BigInt to number

Cannot convert a BigInt value to a number

  • Use Number(bigint) explicitly
  • Keep operations within same type
javascript3 fixes

TypeError: Cannot mix BigInt and other types

Cannot mix BigInt and other types

  • Convert both operands to same type
  • Use BigInt() or Number() explicitly
javascript3 fixes

TypeError: Illegal invocation

Illegal invocation

  • Bind the correct this context
  • Use arrow function for callback
javascript3 fixes

TypeError: Cannot define property, object is not extensible

Cannot define property .* object is not extensible

  • Clone object before adding properties
  • Don't call Object.preventExtensions()
javascript3 fixes

TypeError: Cannot delete property

Cannot delete property .* of

  • Check if property is configurable
  • Clone object and omit property
javascript3 fixes

TypeError: arguments restricted in strict mode

'caller', 'callee', and 'arguments' properties may not be accessed

  • Use rest parameters (...args)
  • Remove 'use strict' if needed
javascript3 fixes

SyntaxError: Identifier has already been declared

Identifier .* has already been declared

  • Rename duplicate variable
  • Use different scope (block/function)
javascript3 fixes

ReferenceError: Cannot access before initialization (TDZ)

Cannot access .* before initialization

  • Move variable declaration before usage
  • Reorder code to avoid temporal dead zone
javascript3 fixes

SyntaxError: Invalid or unexpected token

Invalid or unexpected token

  • Check for invisible unicode characters
  • Remove smart quotes
javascript3 fixes

SyntaxError: Unexpected reserved word

Unexpected reserved word

  • Rename variable using reserved word
  • Add type:module for await usage
javascript3 fixes

SyntaxError: await only valid in async function

'await' is only valid in async function

  • Mark containing function as async
  • Use .then() instead
javascript3 fixes

Iterator/Generator protocol TypeError

Argument of type .* is not assignable

  • Implement Symbol.iterator correctly
  • Return proper {value, done} shape
javascript3 fixes

SharedArrayBuffer not available (COOP/COEP)

SharedArrayBuffer is not defined

  • Set Cross-Origin-Opener-Policy: same-origin header
  • Set Cross-Origin-Embedder-Policy: require-corp header
javascript3 fixes

Atomics.wait not allowed on main thread

Atomics\.wait cannot be called in this context

  • Move Atomics.wait to Worker thread
  • Use Atomics.waitAsync instead
javascript3 fixes

TypeError: WeakRef target must be object

WeakRef target must be an object or symbol

  • Pass object or symbol to WeakRef
  • Don't use primitives with WeakRef
javascript3 fixes

FinalizationRegistry callback error

FinalizationRegistry.*callback

  • Ensure callback is a function
  • Don't hold strong reference to target
javascript3 fixes

TypeError: Proxy trap invariant violation

Proxy.*trap.*returned

  • Ensure trap return matches target property descriptor
  • Return consistent values from get trap
javascript3 fixes

TypeError: Proxy set trap returned falsish

'set' on proxy: trap returned falsish

  • Return true from set trap after handling
  • Check if target property is writable
javascript3 fixes

TypeError: Proxy deleteProperty trap violation

'deleteProperty' on proxy

  • Return true from deleteProperty trap
  • Ensure property is configurable on target
javascript3 fixes

TypeError: Proxy defineProperty trap violation

'defineProperty' on proxy.*trap

  • Ensure trap matches Object.defineProperty semantics
  • Return true from defineProperty handler
javascript3 fixes

TypeError: Proxy getPrototypeOf must return object or null

'getPrototypeOf'.*trap.*returned neither an object nor null

  • Return object or null from getPrototypeOf trap
  • Use Reflect.getPrototypeOf as fallback
javascript3 fixes

TypeError: Generator is already running

Generator is already running

  • Don't call next() from within generator body
  • Avoid recursive generator invocation
javascript3 fixes

RangeError: Invalid language/locale tag

(Intl|RangeError).*locale

  • Use valid BCP 47 language tag
  • Check Intl.getCanonicalLocales() support
javascript3 fixes

TypeError: Intl API not a constructor

Intl\..*is not a constructor

  • Check browser/Node.js version supports the Intl API
  • Polyfill with @formatjs packages
javascript3 fixes

RangeError: Invalid time zone

Invalid time zone specified

  • Use IANA timezone identifier
  • Check Intl.supportedValuesOf('timeZone')
javascript3 fixes

DOMException: Object cannot be cloned (structuredClone)

structuredClone.*could not be cloned

  • Remove functions from object before cloning
  • Break circular references
javascript3 fixes

TypeError: Converting circular structure to JSON

Converting circular structure to JSON

  • Use replacer function to handle cycles
  • Use libraries like flatted or safe-stringify
javascript3 fixes

Import assertions not supported

import assertions are not supported

  • Use import attributes (with) instead of assert
  • Update to Node.js 20.10+
javascript3 fixes

Import attribute type not supported

Import attribute.*type.*not supported

  • Check runtime supports JSON/CSS import attributes
  • Use fetch() or require() as alternative
javascript3 fixes

Top-level await not available in this context

Top-level await is not available

  • Set type:module in package.json
  • Use .mjs extension
javascript3 fixes

SyntaxError: Module does not provide named export

The requested module .* does not provide an export named

  • Check export name matches import
  • Use default import instead
javascript3 fixes

Cannot require() an ES module

require\(\) of ES Module .* not supported

  • Use dynamic import() instead
  • Convert caller to ESM
javascript3 fixes

Module has no default export

Module .* has no default export

  • Use named import { x } syntax
  • Add esModuleInterop:true to tsconfig
javascript3 fixes

SyntaxError: Octal literals in strict mode

Octal literals are not allowed in strict mode

  • Use 0o prefix for octal (0o777)
  • Convert to decimal or hex
javascript3 fixes

SyntaxError: Delete unqualified identifier in strict mode

Delete of an unqualified identifier in strict mode

  • Delete object property instead of variable
  • Remove delete statement
javascript3 fixes

SyntaxError: with statement in strict mode

'with' statements are not allowed in strict mode

  • Use destructuring instead of with
  • Assign properties to local variables
javascript3 fixes

TypeError: null is not an object

null is not an object

  • Add null check before property access
  • Use optional chaining (?.)
javascript3 fixes

TypeError: Symbol.iterator is not a function

Symbol\.iterator.*is not a function

  • Implement [Symbol.iterator] on custom object
  • Ensure iterable protocol is correct
javascript3 fixes

TypeError: Reflect method called on non-object

Reflect\..*called on non-object

  • Pass object as first argument to Reflect method
  • Check target is not null/undefined
javascript3 fixes

TypeError: Right-hand side of in is not an object

Right-hand side of 'in' is not an object

  • Check that variable is an object before using 'in'
  • Add type guard
javascript3 fixes

TypeError: Cannot create property on primitive

Cannot create property .* on (string|number|boolean)

  • Convert to object wrapper or use different structure
  • Check variable type before assignment
javascript3 fixes

ReferenceError: Super constructor called twice

Super constructor may only be called once

  • Call super() only once in constructor
  • Remove duplicate super() call
javascript3 fixes

ReferenceError: Must call super in derived class

Must call super constructor in derived class

  • Add super() call at top of constructor
  • Call super before accessing this
javascript3 fixes

TypeError: Class must be called with new

Class constructor .* cannot be invoked without 'new'

  • Use new keyword: new MyClass()
  • Check you're not calling class as function
javascript3 fixes

SyntaxError: Private field not declared

Private field .* must be declared in an enclosing class

  • Declare #field in class body
  • Check spelling of private field name
javascript3 fixes

TypeError: Private member access on wrong class

Cannot read private member .* from an object whose class did not declare it

  • Ensure object is instance of declaring class
  • Use instanceof check before access
javascript3 fixes

RangeError: Invalid array length

Invalid array length

  • Ensure array length is non-negative integer
  • Check Array constructor argument
javascript3 fixes

RangeError: Invalid count value (repeat/padStart)

Invalid count value

  • Ensure count is non-negative finite integer
  • Check for NaN or Infinity
javascript3 fixes

RangeError: toString() radix out of range

toString\(\) radix must be between 2 and 36

  • Use radix between 2 and 36
  • Default to base 10 or 16
javascript3 fixes

URIError: URI malformed

URI malformed

  • Use encodeURIComponent before decoding
  • Catch URIError and handle gracefully
javascript3 fixes

SyntaxError: Invalid regular expression

Invalid regular expression

  • Escape special regex characters
  • Use RegExp constructor with try/catch
javascript3 fixes

TypeError: Method called on incompatible receiver

called on incompatible receiver

  • Bind method to correct object
  • Don't destructure methods from typed arrays
javascript3 fixes

TypeError: Symbol cannot be converted

Symbol.*cannot be converted to (a number|string)

  • Use symbol.toString() or symbol.description
  • Don't use Symbol in arithmetic
javascript3 fixes

SyntaxError: Duplicate parameter name

Duplicate parameter name not allowed

  • Rename duplicate parameters
  • Use rest parameters
javascript3 fixes

SyntaxError: Setter must have one parameter

Setter must have exactly one formal parameter

  • Give setter exactly one parameter
  • Don't use rest parameters in setter
javascript3 fixes

SyntaxError: Getter must not have parameters

(Getter|Setter) must not have any formal parameters

  • Remove parameters from getter
  • Move logic to a method instead
javascript3 fixes

SyntaxError: Rest parameter must be last

Rest parameter must be last formal parameter

  • Move ...rest to end of parameter list
  • Use destructuring for middle collection
javascript3 fixes

TypeError: Spread requires iterable

Spread syntax requires.*iterable

  • Ensure value is iterable before spreading
  • Use Object.entries() for objects
javascript3 fixes

SyntaxError: yield not allowed in arrow function

yield.*is not allowed in.*arrow function

  • Use regular function* for generators
  • Don't use arrow functions as generators
javascript3 fixes

Generator already returned/closed

already has been.*'return'

  • Don't call next() after return
  • Check generator done state
javascript3 fixes

SyntaxError: for-await only in async functions

for-await.*not valid in (sync|non-async)

  • Mark containing function as async
  • Use regular for-of for sync iterables
javascript3 fixes

TypeError: Union member is not callable

Each member of the union.*is not callable

  • Narrow type before calling
  • Add type guard
javascript3 fixes

Unexpected void operator in expression

void operator.*unexpected

  • Remove void from nullish coalescing left side
  • Use undefined explicitly
javascript3 fixes

SyntaxError: Cannot assign to optional chaining expression

Optional chaining.*cannot.*assign

  • Check existence first, then assign separately
  • Use if statement for null check
javascript3 fixes

SyntaxError: Tagged template with optional chaining

tagged template.*cannot.*optional chain

  • Check tag function exists before calling
  • Use conditional: fn ? fn`...` : default
javascript3 fixes

SyntaxError: new with optional chaining

new.*optional chain

  • Don't use new with ?.
  • Check constructor exists then call new separately
javascript3 fixes

SyntaxError: import.meta outside module

import\.meta.*outside.*module

  • Set type:module in package.json
  • Use .mjs file extension
javascript3 fixes

SyntaxError: enum is a reserved word

Unexpected (strict mode |)reserved word.*enum

  • Rename variable from 'enum'
  • Use different identifier
javascript3 fixes

TypeError: Invalid WeakMap key

WeakMap key must be an object or.*symbol

  • Use object or unregistered symbol as key
  • Don't use primitives as WeakMap keys
javascript3 fixes

TypeError: Invalid WeakSet value

WeakSet value must be an object

  • Use object as WeakSet value
  • Don't add primitives to WeakSet
javascript3 fixes

RangeError: Precision out of range

Precision is out of range

  • Use precision between 1-100 for toPrecision
  • Use 0-100 for toFixed
javascript3 fixes

RangeError: Invalid normalization form

String.prototype.normalize.*form

  • Use valid form: NFC, NFD, NFKC, NFKD
  • Default to NFC if unsure
javascript3 fixes

TypeError: Derived constructor must return object

Derived.*must return object or undefined

  • Remove or fix return statement in constructor
  • Return object or don't return anything
javascript3 fixes

TypeError: Object is not extensible (Object.freeze)

object is not extensible

  • Clone frozen object before modifying
  • Use spread to create new object with changes
javascript3 fixes

AggregateError: Multiple errors in Promise.any

AggregateError

  • Ensure at least one promise resolves
  • Check errors array on AggregateError
javascript3 fixes

TypeError: Iterator result is not an object

Iterator result.*is not an object

  • Return { value, done } object from next()
  • Implement iterator protocol correctly
javascript3 fixes

SyntaxError: Duplicate export of name

Duplicate export.*module

  • Remove duplicate export
  • Use 'as' to rename one export
javascript3 fixes

TypeError: Cannot redefine property

Cannot redefine property

  • Check Object.defineProperty descriptor
  • Ensure property is configurable
javascript3 fixes

TypeError: Detached ArrayBuffer

(DataView|TypedArray).*detached.*buffer

  • Don't use ArrayBuffer after transfer
  • Check if buffer is detached before access
javascript3 fixes

TypeError: Promise resolved with itself (chaining cycle)

Promise resolution is itself

  • Don't resolve promise with itself
  • Return different value from then handler
javascript3 fixes

AbortError: Signal has been aborted

AbortError.*signal.*aborted

  • Handle AbortError in catch block
  • Check signal.aborted before operations
javascript3 fixes

TimeoutError: Signal timed out

TimeoutError.*signal.*timed out

  • Increase timeout duration
  • Handle TimeoutError specifically
javascript3 fixes

Warning: Promise executor already resolved

already.*been.*resolved

  • Only resolve/reject once
  • Guard with boolean flag
javascript3 fixes

UnhandledPromiseRejection

Unhandled promise rejection

  • Add .catch() to promise chain
  • Use try/catch with async/await
javascript3 fixes

TypeError: Object.fromEntries requires iterable

Object\.fromEntries.*requires.*iterable

  • Pass array of [key, value] pairs
  • Convert Map to entries first
javascript3 fixes

TypeError: Setting property with only getter

property.*has.*getter.*no setter

  • Add setter to property definition
  • Don't assign to getter-only properties
javascript3 fixes

TypeError: replaceAll with non-global regex

String\.prototype\.replaceAll.*called.*global

  • Add g flag to regex: /pattern/g
  • Use replace with /g flag instead
javascript3 fixes

MongoDB duplicate key error on _id

MongoDB.*E11000.*duplicate key error.*index:.*_id_

  • Let MongoDB auto-generate _id instead of specifying manually
  • Use updateOne with upsert:true for insert-or-update patterns
javascript3 fixes

MongoDB aggregation exceeded memory limit

MongoDB.*Exceeded memory limit for.*\$group.*allowDiskUse

  • Add {allowDiskUse: true} to aggregate() options
  • Add $match/$project stages early to reduce data volume
javascript3 fixes

MongoDB Atlas Search index not found

MongoDB.*Atlas Search.*index.*not found

  • Create the Atlas Search index via Atlas UI or API
  • Verify index name in $search stage matches the created index
javascript3 fixes

MongoDB change stream resume token expired

MongoDB.*ChangeStream.*resume token.*not found.*oplog

  • Increase oplog size to retain events longer
  • Store resume tokens more frequently in your application
javascript3 fixes

MongoDB time series metaField immutable after creation

MongoDB.*time.*series.*collection.*meta field.*cannot be.*updated

  • metaField cannot be changed after collection creation - recreate collection
  • Plan time series collection schema carefully before creation
javascript3 fixes

MongoDB $lookup from sharded collection limitation

MongoDB.*\$lookup.*from.*sharded collection.*not supported

  • $lookup target collection must be unsharded (or use $lookup with pipeline in 5.1+)
  • Denormalize data to avoid cross-shard lookups
javascript3 fixes

MongoDB $merge into sharded collection error

MongoDB.*\$merge.*into.*sharded output.*unordered

  • Ensure $merge uses 'on' field matching the shard key
  • Use whenMatched and whenNotMatched options explicitly
javascript3 fixes

MongoDB $unionWith cross-database limitation

MongoDB.*\$unionWith.*requires all input collections.*same database

  • All collections in $unionWith must be in the same database
  • Copy data to same database before aggregation
javascript3 fixes

MongoDB stale chunk config during migration

MongoDB.*StaleConfig.*chunk migration.*not reflect.*current state

  • Retry the operation - stale config is usually transient
  • Run sh.status() to check balancer and chunk distribution
javascript3 fixes

MongoDB incomplete transaction history in oplog

MongoDB.*IncompleteTransactionHistory.*oplog.*insufficient

  • Increase oplog size: replSetResizeOplog
  • Reduce long-running transactions that span large oplog windows
javascript3 fixes

MongoDB operation exceeded maxTimeMS

MongoDB.*MaxTimeMSExpired.*operation exceeded time limit

  • Optimize the query with proper indexes
  • Increase maxTimeMS if the operation legitimately needs more time
javascript3 fixes

MongoDB Atlas Search field not in index definition

MongoDB.*\$search.*index definition.*does not cover.*field

  • Update Atlas Search index to include the queried field
  • Use dynamic mapping to index all fields automatically
javascript3 fixes

MongoDB write conflict in WiredTiger

MongoDB.*WriteConflict.*write conflict during.*operation

  • Retry the operation - WiredTiger retries internally but may surface this
  • Reduce write contention on the same document
javascript3 fixes

MongoDB $graphLookup max depth exceeded

MongoDB.*\$graphLookup.*exceeded.*maximum depth

  • Set maxDepth parameter to limit traversal depth
  • Add restrictSearchWithMatch to narrow the graph exploration
javascript3 fixes

MongoDB write concern replication timeout

MongoDB.*bulk write.*error.*WriteConcernError.*replication timeout

  • Increase wtimeout for write operations
  • Reduce write concern from majority to w:1 if appropriate
javascript3 fixes

MongoDB $regex options conflict

MongoDB.*BadValue.*\$regex.*does not support.*options.*with.*\$options

  • Use either inline regex options /pattern/i or $options, not both
  • Move options to $options field: {$regex: 'pattern', $options: 'i'}
javascript3 fixes

MongoDB aggregation exceeded document size limit

MongoDB.*PlanExecutor.*error.*during.*aggregation.*BufBuilder.*grow.*beyond.*limit

  • Reduce individual document sizes in pipeline output
  • $unwind before $group to avoid massive grouped documents
javascript3 fixes

MongoDB $densify field type requirement

MongoDB.*\$densify.*field must be.*date.*or number

  • Ensure the field used in $densify is a date or numeric type
  • Convert field type before $densify stage: $addFields with $toDate
javascript3 fixes

Cypress element not found timeout

Timed out retrying.*cy\.get.*Expected to find element

  • Increase defaultCommandTimeout
  • Use cy.get with {timeout: N}
javascript3 fixes

Cypress intercept no matching request

cy\.intercept.*failed to match any request

  • Verify route pattern matches actual request
  • Use cy.intercept before action that triggers request
javascript3 fixes

Cypress assertion value mismatch

AssertionError.*expected.*to (equal|have|be).*but got

  • Use .should with retry-ability
  • Wait for data to load before assertion
javascript3 fixes

Cypress command outside test context

cy\..*can only be called inside.*running test

  • Move cy calls into it()/beforeEach blocks
  • Don't use cy in after() for cleanup
javascript3 fixes

Cypress cross-origin navigation

Cypress.*detected.*cross-origin.*error

  • Use cy.origin() for cross-origin flows
  • Configure chromeWebSecurity: false
javascript3 fixes

Cypress component mount failure

Cypress.*component.*mount.*failed|mount.*did not render

  • Provide required props to mount()
  • Import and register dependencies
javascript3 fixes

Cypress intercept response undefined

cy\.intercept.*response.*undefined|cy\.wait.*no response

  • Add .as() alias and cy.wait('@alias')
  • Provide fixture response in intercept
javascript3 fixes

Cypress task timeout or failure

Cypress.*task.*timed out|cy\.task.*failed

  • Increase taskTimeout in config
  • Register task in cypress.config plugins
javascript3 fixes

Cypress type on non-input element

cy\.type.*can only be called on.*input|textarea

  • Target the actual input element
  • Use .find('input') to get nested input
javascript3 fixes

Cypress element detached from DOM

Cypress.*detached from.*DOM

  • Re-query element after action that re-renders
  • Use .should() to retry until element stable
javascript3 fixes

Playwright locator click timeout

locator\.click.*timeout.*waiting for.*element

  • Increase timeout in click options
  • Use waitFor before click
javascript3 fixes

Playwright strict mode multiple matches

page\.locator.*strict mode violation.*resolved to \d+ elements

  • Make locator more specific
  • Use .first()/.nth(n) for specific element
javascript3 fixes

Playwright element not visible

Playwright.*waiting for.*selector.*to be visible

  • Wait for animation/transition to complete
  • Use {state: 'visible'} in waitForSelector
javascript3 fixes

Playwright visual regression mismatch

Playwright.*screenshot comparison.*does not match

  • Update baseline with --update-snapshots
  • Increase threshold in toMatchSnapshot
javascript3 fixes

Playwright trace not enabled

Playwright.*trace.*cannot be collected.*not enabled

  • Set trace: 'on-first-retry' in config
  • Use context.tracing.start() before test
javascript3 fixes

Playwright route intercept failure

page\.route.*failed to intercept

  • Set up route before navigation
  • Use ** glob for flexible matching
javascript3 fixes

Playwright test timeout exceeded

Playwright.*Test timeout of \d+ms exceeded

  • Increase test timeout in config
  • Add test.setTimeout() for slow tests
javascript3 fixes

Playwright frame navigated/closed during action

Playwright.*frame.*navigated.*target closed

  • Use page.waitForNavigation with action
  • Handle frame navigation in try-catch
javascript3 fixes

Playwright browser process crashed

Playwright.*browser.*closed.*unexpected

  • Reduce parallel workers
  • Increase browserContext timeout
javascript3 fixes

Playwright screenshot pixel diff exceeded

expect.*toHaveScreenshot.*maxDiffPixels exceeded

  • Increase maxDiffPixels or maxDiffPixelRatio
  • Wait for animations to complete
javascript3 fixes

Vitest module mock not found

vitest.*Cannot mock.*module.*not found

  • Check module path matches import exactly
  • Use vi.mock with factory function
javascript3 fixes

Vitest mock variable not hoisted

vitest.*ReferenceError.*not defined.*vi\.mock

  • Use vi.hoisted() for variables used in mock
  • Define mock implementation inline
javascript3 fixes

Vitest coverage reports no statements

vitest.*coverage.*no.*statements.*found

  • Configure coverage provider (v8/istanbul)
  • Set coverage.include patterns correctly
javascript3 fixes

Vitest browser mode module error

vitest.*browser mode.*module.*not supported

  • Use vitest/browser provider configuration
  • Mock Node.js modules for browser
javascript3 fixes

Vitest mock returns wrong type

vitest.*TypeError.*is not a function.*mock

  • Use vi.fn().mockReturnValue() correctly
  • Return correct type from mock factory
javascript3 fixes

Storybook unsupported arg type

Storybook.*args.*of type.*not supported

  • Define argTypes with control type
  • Use correct control for complex types
javascript3 fixes

Storybook decorator render failure

Storybook.*decorator.*cannot.*render|decorator.*returned null

  • Return Story component from decorator
  • Wrap Story in proper provider context
javascript3 fixes

Storybook CSF3 invalid meta export

Storybook.*CSF3.*meta.*export.*invalid

  • Use satisfies Meta<typeof Component> syntax
  • Export default meta object correctly
javascript3 fixes

Storybook interaction test timeout

Storybook.*interaction.*step.*timed out|play function.*timeout

  • Increase step timeout
  • Use await findBy* for async elements
javascript3 fixes

Storybook cannot find stories

Storybook.*Cannot find module.*stories

  • Check stories glob in main.js/ts
  • Verify story file naming convention
javascript3 fixes

k6 response time threshold failed

k6.*thresholds.*failed.*http_req_duration

  • Optimize backend response time
  • Adjust threshold percentile/value
javascript3 fixes

k6 connection refused to target

k6.*GoError.*dial.*connection refused|k6.*request failed

  • Verify target URL is accessible
  • Check target server can handle load
javascript3 fixes

k6 too many dropped iterations

k6.*dropped_iterations.*too many

  • Increase scenario duration
  • Reduce arrival rate
javascript3 fixes

k6 max VUs exceeded

k6.*vus_max.*exceeded

  • Increase maxVUs in scenario options
  • Use ramping-vus for gradual increase
javascript3 fixes

Artillery target connection failure

artillery.*target.*ECONNREFUSED|artillery.*socket hang up

  • Check target URL is correct
  • Verify server handles concurrent connections
javascript3 fixes

Artillery config validation error

artillery.*phase.*ramp.*invalid|artillery.*config.*validation

  • Check YAML/JSON syntax in artillery config
  • Verify phase parameters (duration, rate)
javascript3 fixes

Cypress session validation failed

Cypress.*cy\.session.*validation failed

  • Update session validate function
  • Clear session with cy.session(id, setup, {cacheAcrossSpecs})
javascript3 fixes

Vitest snapshot mismatch

vitest.*snapshot.*does not match.*stored

  • Update snapshots with --update flag
  • Review changes in snapshot diff
javascript3 fixes

Playwright toBeVisible assertion timeout

Playwright.*expect.*toBeVisible.*timed out

  • Increase assertion timeout
  • Check element exists in DOM first
javascript3 fixes

Storybook addon load failure

Storybook.*addon.*failed.*load|addon.*not compatible

  • Update addon to compatible version
  • Check Storybook version compatibility
javascript3 fixes

k6 executor configuration invalid

k6.*scenario.*executor.*invalid configuration

  • Use valid executor type name
  • Match executor options to type
javascript3 fixes

Cypress blocked by CORS

Cypress.*origin.*blocked.*CORS

  • Use cy.intercept to bypass CORS in tests
  • Configure chromeWebSecurity: false
javascript3 fixes

Cypress click blocked by overlay

cy\.click.*element is.*covered by another element

  • Use {force: true} to bypass check
  • Close overlay/modal before clicking
javascript3 fixes

Cypress uncaught application error

Cypress.*uncaught.*exception.*application

  • Handle in Cypress.on('uncaught:exception')
  • Fix application error
javascript3 fixes

Cypress scrollIntoView on non-scrollable

cy\.scrollIntoView.*not scrollable|not within.*scrollable

  • Target the scrollable parent container
  • Use cy.scrollTo on correct element
javascript3 fixes

Playwright navigation network error

Playwright.*page\.goto.*net::ERR_

  • Verify URL is correct and server running
  • Add waitUntil: 'domcontentloaded'
javascript3 fixes

Playwright iframe detached

Playwright.*frame\.locator.*frame has been detached

  • Wait for frame to be attached
  • Re-query frame after navigation
javascript3 fixes

Playwright download timeout

Playwright.*download.*timed out.*waiting for download

  • Use page.waitForEvent('download')
  • Increase download timeout
javascript3 fixes

Playwright text content mismatch

Playwright.*toHaveText.*expected.*received

  • Check for whitespace/newline differences
  • Use toContainText for partial match
javascript3 fixes

Playwright API test status mismatch

Playwright.*API testing.*status.*expected 200.*received

  • Verify API endpoint and method
  • Check authentication headers
javascript3 fixes

Vitest worker isolation failure

vitest.*isolate.*worker.*failed

  • Set pool: 'forks' in vitest config
  • Increase worker memory limit
javascript3 fixes

Vitest spy on undefined or already spied

vitest.*cannot spy.*already.*spied|vi\.spyOn.*target.*undefined

  • Reset spies with vi.restoreAllMocks()
  • Verify object/method exists before spy
javascript3 fixes

Vitest mock never called assertion

vitest.*expect.*toHaveBeenCalled.*never called

  • Verify function is actually invoked in code
  • Check mock is set up before action
javascript3 fixes

Vitest fake timers not advancing

vitest.*timer.*not advancing|vi\.advanceTimersByTime.*no effect

  • Call vi.useFakeTimers() before test
  • Use vi.runAllTimers() for pending timers
javascript3 fixes

Vitest typecheck mode failure

vitest.*typecheck.*failed|vitest.*type error

  • Fix TypeScript type errors in test file
  • Use expect<Type> for type assertions
javascript3 fixes

Storybook webpack module not found

Storybook.*webpack.*Module not found

  • Add module to Storybook webpack config
  • Configure aliases in .storybook/main.ts
javascript3 fixes

Storybook toolbar addon not appearing

Storybook.*globalTypes.*toolbar.*not appearing

  • Register globalTypes in preview.ts
  • Add @storybook/addon-toolbars to addons
javascript3 fixes

Storybook async loader timeout

Storybook.*loaders.*async.*timeout

  • Increase loader timeout
  • Fix async data fetching in loader
javascript3 fixes

Storybook composition remote ref failure

Storybook.*composition.*ref.*failed.*connect

  • Verify remote Storybook URL is accessible
  • Configure CORS on remote Storybook
javascript3 fixes

k6 check rate below threshold

k6.*checks.*failed.*rate below threshold

  • Fix failing request checks
  • Adjust check rate threshold
javascript3 fixes

k6 HTTP request failure rate exceeded

k6.*http_req_failed.*above threshold

  • Fix server errors under load
  • Scale backend resources
javascript3 fixes

k6 InfluxDB output connection failure

k6.*output.*influxdb.*connection refused

  • Verify InfluxDB is running
  • Check k6 output URL configuration
javascript3 fixes

Artillery plugin or engine not found

artillery.*plugin.*not found|artillery.*engine.*unknown

  • Install artillery plugin package
  • Configure engine in config section
javascript3 fixes

Artillery scenario timeout

artillery.*think.*exceed.*timeout|artillery.*scenario.*timeout

  • Increase scenario timeout in config
  • Reduce think time between requests
javascript3 fixes

Cypress fixture file not found

Cypress.*fixture.*not found|cy\.fixture.*ENOENT

  • Check fixture path relative to cypress/fixtures
  • Verify file name and extension
javascript3 fixes

Playwright expect.poll condition timeout

Playwright.*expect\.poll.*timeout.*condition not met

  • Increase poll timeout
  • Check condition logic is correct
javascript3 fixes

Vitest setup file error

vitest.*setupFile.*error|vitest.*globalSetup.*failed

  • Fix error in setup file code
  • Check file path in vitest.config
javascript3 fixes

Storybook autodocs extraction failure

Storybook.*docs.*autodocs.*failed to extract

  • Add JSDoc comments to component props
  • Configure autodocs in meta export
javascript3 fixes

k6 extension not compiled in binary

k6.*extensions.*not compiled|xk6.*module.*missing

  • Build custom k6 with xk6
  • Use pre-built k6 with extension
javascript3 fixes

Cypress viewport below minimum

Cypress.*viewport.*minimum.*width

  • Use cy.viewport with valid dimensions
  • Set viewportWidth/Height in config
javascript3 fixes

Playwright browser executable not found

Playwright.*browserType\.launch.*executable doesn't exist

  • Run npx playwright install
  • Set executablePath to browser binary
javascript3 fixes

Vitest environment package missing

vitest.*env.*jsdom.*not found|vitest.*environment.*missing

  • Install jsdom or happy-dom package
  • Set environment in vitest.config
javascript3 fixes

Storybook Vite builder plugin conflict

Storybook.*builder.*vite.*plugin.*conflict

  • Move conflicting plugin to storybook viteFinal config
  • Exclude plugin from Storybook build
javascript3 fixes

Artillery scenario weight/probability error

artillery.*scenario.*weight.*must sum|scenario.*probability.*invalid

  • Ensure scenario weights are valid
  • Remove probability if using weight
javascript3 fixes

Cypress cy.request HTTP error

cy\.request.*status code.*4\d\d|cy\.request.*failed

  • Set failOnStatusCode: false
  • Check request URL and headers
javascript3 fixes

Playwright element count mismatch

Playwright.*toHaveCount.*expected \d+.*received \d+

  • Wait for elements to render
  • Check locator specificity
javascript3 fixes

Vitest concurrent test shared state

vitest.*concurrent.*shared state.*conflict

  • Isolate state per test
  • Use test.concurrent with fresh fixtures
javascript3 fixes

Storybook userEvent not available in play

Storybook.*play function.*userEvent.*not available

  • Import from @storybook/test
  • Use within(canvasElement) for scoped queries
javascript3 fixes

k6 ramping stages configuration error

k6.*ramping.*stages.*invalid|stages.*target.*negative

  • Use non-negative target values
  • Ensure stages array is not empty
javascript3 fixes

Cypress experimental feature not enabled

Cypress.*experimental.*feature.*not enabled|experimentalRunAllSpecs

  • Enable in cypress.config: experimentalFeature: true
  • Upgrade Cypress for stable feature
javascript3 fixes

Playwright webServer not ready

Playwright.*webServer.*failed to start|webServer.*port.*not ready

  • Increase webServer timeout
  • Check server start command works
javascript3 fixes

EPIPE error - writing to closed pipe/socket

Error: write EPIPE

  • Handle the 'error' event on the writable stream before writing
  • Check stream.writable before calling write()
javascript3 fixes

ECONNRESET - connection forcibly closed by remote

Error: read ECONNRESET

  • Implement retry logic with exponential backoff for transient network failures
  • Handle the 'error' event on the socket/request and log details for debugging
javascript3 fixes

Node.js memory leak - heap out of memory

FATAL ERROR:.*JavaScript heap out of memory

  • Use --max-old-space-size=4096 to increase heap limit temporarily while investigating
  • Profile with node --inspect and Chrome DevTools Memory tab to find retained objects
javascript3 fixes

Event loop blocked by synchronous operation

event loop.*blocked.*exceeded.*ms

  • Move CPU-intensive work to a Worker thread using worker_threads module
  • Break large synchronous loops into batches using setImmediate() between chunks
javascript3 fixes

Stream push after end-of-file signal

Error: stream\.push\(\) after EOF

  • Ensure push(null) is only called once and no more data is pushed after it
  • Check your _read() implementation for race conditions that push after stream end
javascript3 fixes

Cluster worker crashed unexpectedly

Worker.*died.*exit code.*signal

  • Listen for 'exit' event on cluster workers and fork a replacement: cluster.on('exit', (worker) => cluster.fork())
  • Add uncaughtException and unhandledRejection handlers in worker processes
javascript3 fixes

Unhandled promise rejection crashing process

UnhandledPromiseRejection.*promise rejected.*no.*handler

  • Add .catch() to every promise chain, or use try/catch with async/await
  • Set global handler: process.on('unhandledRejection', (reason, promise) => { log and gracefully shut down })
javascript3 fixes

CORS middleware order or configuration issue

Access-Control-Allow-Origin.*not.*present|CORS.*blocked|No 'Access-Control-Allow-Origin'

  • Ensure cors() middleware is registered BEFORE your route handlers in Express
  • For credentials, set { origin: 'http://specific-domain.com', credentials: true } — wildcard '*' won't work with credentials
javascript3 fixes

EventEmitter memory leak - too many listeners

MaxListenersExceededWarning.*Possible.*memory leak

  • Remove listeners in cleanup: emitter.removeListener() or emitter.off() when done
  • If legitimate, increase limit: emitter.setMaxListeners(n) with a comment explaining why
javascript3 fixes

Socket hang up - premature connection close

Error: socket hang up

  • Increase server timeout: server.timeout = 120000 for long-running requests
  • Handle the 'error' event on both request and response objects
javascript3 fixes

Headers already sent - double response

ERR_HTTP_HEADERS_SENT.*Cannot set headers after they are sent

  • Add return statement after res.send()/res.json()/res.redirect() to prevent further execution
  • Check async callbacks for multiple paths that call res.send()
javascript3 fixes

Connection timeout to external service

Error: connect ETIMEDOUT

  • Set explicit timeout on HTTP requests: { timeout: 5000 } and handle the timeout event
  • Implement circuit breaker pattern to fail fast when service is consistently unavailable
javascript3 fixes

System out of memory for child process or buffer

Error.*ENOMEM.*Cannot allocate memory

  • Reduce buffer sizes and use streaming instead of buffering entire payloads
  • Increase system swap or available RAM; check for memory leaks in long-running processes
javascript3 fixes

File descriptor limit exhausted

Error: EMFILE.*too many open files

  • Use graceful-fs or limit concurrent file operations with a semaphore/queue (e.g., p-limit)
  • Increase OS file descriptor limit: ulimit -n 65536
javascript3 fixes

Stream closed before pipeline finished

ERR_STREAM_PREMATURE_CLOSE

  • Use stream.pipeline() instead of manual pipe() — it handles cleanup and error propagation
  • Handle 'error' and 'close' events on all streams in the pipeline
javascript3 fixes

Express body parser payload limit exceeded

PayloadTooLargeError.*request entity too large

  • Increase the limit: app.use(express.json({ limit: '10mb' }))
  • For file uploads, use multer with appropriate fileSize limits instead of body-parser
javascript3 fixes

Node.js rejecting self-signed certificate

Error: self signed certificate in certificate chain

  • For development only: set NODE_TLS_REJECT_UNAUTHORIZED=0 (NEVER in production)
  • Add the CA cert to the request agent: new https.Agent({ ca: fs.readFileSync('ca.pem') })
javascript3 fixes

Port already in use - address bind failed

Error.*EADDRINUSE.*address already in use.*:\d+

  • Kill the existing process: lsof -i :PORT then kill -9 PID (or netstat -tlnp on Linux)
  • Use a different port or implement automatic port finding with portfinder package
javascript3 fixes

Stack overflow from deep recursion

RangeError.*Maximum call stack size exceeded

  • Convert recursion to iteration using an explicit stack (array)
  • Use setImmediate() to break deep recursion into async ticks
javascript3 fixes

Client aborted request before response complete

Error: aborted.*request aborted by client

  • Listen for 'close' event on req to detect client disconnection and stop processing
  • Use AbortController/AbortSignal to cancel downstream operations when client disconnects
javascript3 fixes

SameSite cookie attribute blocking cross-site requests

SameSite.*cookie.*cross-site|cookie.*not set.*SameSite.*None

  • Set SameSite=None; Secure on cookies that need cross-site access (requires HTTPS)
  • For same-site only cookies, use SameSite=Lax (default in modern browsers) or SameSite=Strict
javascript3 fixes

CORS with credentials cannot use wildcard origin

CORS.*credentials.*wildcard|Access-Control-Allow-Origin.*\*.*credentials

  • Replace Access-Control-Allow-Origin: * with the specific requesting origin when credentials are used
  • Read the Origin header from the request and echo it back (after validating it's allowed)
javascript3 fixes

WebSocket closed abnormally (code 1006)

WebSocket connection.*closed abnormally|code.*1006|abnormal closure

  • 1006 means no close frame was received — check for network interruptions or proxy timeouts
  • Implement automatic reconnection with exponential backoff on abnormal close
javascript3 fixes

WebSocket handshake failure

WebSocket.*handshake.*failed|Error during WebSocket handshake|unexpected response code: 4\d{2}

  • Ensure the server responds with HTTP 101 Switching Protocols — check for middleware intercepting the upgrade
  • Verify proxy is configured for WebSocket: proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'
javascript3 fixes

WebSocket message size limit exceeded

WebSocket.*frame.*too (big|large)|RangeError.*Max payload size exceeded|message too big

  • Increase maxPayload on the server: new WebSocket.Server({ maxPayload: 10 * 1024 * 1024 })
  • Implement message chunking for large payloads — split into smaller frames
javascript3 fixes

WebSocket ping/pong timeout - connection stale

WebSocket.*ping.*timeout|pong.*not received|heartbeat.*failed

  • Implement client-side ping: send periodic ping frames and expect pong within timeout
  • Server-side: use ws.isAlive flag with setInterval ping and terminate dead connections
javascript3 fixes

Attempting to send on closed WebSocket

WebSocket is already in CLOSING or CLOSED state

  • Check ws.readyState === WebSocket.OPEN before calling ws.send()
  • Queue messages during reconnection and flush when connection is re-established
javascript3 fixes

WebSocket reconnection attempts exhausted

WebSocket.*reconnect.*failed|Max reconnection attempts

  • Implement exponential backoff: delay = Math.min(baseDelay * 2^attempt, maxDelay)
  • Show user feedback after max retries and provide a manual reconnect button
javascript3 fixes

WebSocket connection refused by server

WebSocket.*ECONNREFUSED|connect ECONNREFUSED.*ws://

  • Verify the WebSocket server is running and listening on the expected port
  • Check firewall rules allow inbound connections on the WebSocket port
javascript3 fixes

WebSocket protocol violation - invalid frame

Invalid frame header|RSV.*bits must be clear|invalid opcode

  • Ensure both client and server agree on extensions (permessage-deflate RSV bits)
  • Check for intermediary proxies corrupting WebSocket frames — use wss:// to prevent this
javascript3 fixes

WebSocket authentication/authorization failure

WebSocket.*403.*Forbidden|WebSocket.*401.*Unauthorized

  • Pass auth token in the connection URL query string or as a subprotocol: new WebSocket(url, [token])
  • Send auth in the first message after connection opens (WebSocket headers can't be customized in browsers)
javascript3 fixes

WebSocket closed due to policy violation (1008)

WebSocket.*1008.*Policy Violation

  • Check the server's message validation — the message format or content violated server policy
  • Review rate limiting: too many messages in short time can trigger policy closes
javascript3 fixes

WebSocket server internal error (1011)

WebSocket.*1011.*Unexpected Condition|Internal Error.*1011

  • Check server logs for the underlying error that caused the unexpected condition
  • Add error handling in the WebSocket message handler to prevent unhandled exceptions from closing the connection
javascript3 fixes

WebSocket server rejected oversized message (1009)

WebSocket.*1009.*Message Too Big

  • Reduce message size or implement chunked message transfer protocol
  • Increase server's max message size limit if the large payload is legitimate
javascript3 fixes

WebSocket connection establishment timeout

WebSocket.*connection.*timeout|ws.*open.*timed out

  • Increase connection timeout: set a setTimeout on the 'open' event and close if not received
  • Check network path — firewalls or corporate proxies may block WebSocket upgrade requests
javascript3 fixes

WebSocket binary/text frame type mismatch

WebSocket.*binary.*frame.*expected text|unexpected binary message

  • Check ws.binaryType setting on client: 'blob' or 'arraybuffer' for binary messages
  • Ensure sender uses ws.send(string) for text frames and ws.send(buffer) for binary
javascript3 fixes

WebSocket received unsupported data type (1003)

WebSocket.*1003.*Unsupported Data

  • Check that the message encoding matches what the server expects (UTF-8 for text frames)
  • Ensure binary data isn't being sent as a text frame (invalid UTF-8 will trigger 1003)
javascript3 fixes

WebSocket server going away (1001)

WebSocket.*close.*1001.*Going Away

  • Server is shutting down gracefully — implement reconnection logic
  • Check if a load balancer is draining the connection during deployment
javascript3 fixes

WebSocket connection limit reached

WebSocket.*concurrent.*connections.*limit|too many WebSocket connections

  • Implement connection pooling — share a single WebSocket for multiple subscriptions/channels
  • Increase server-side connection limits (ulimit, max file descriptors)
javascript3 fixes

WebSocket subprotocol negotiation failed

WebSocket.*subprotocol.*not supported|Sec-WebSocket-Protocol.*mismatch

  • Ensure client requests a subprotocol the server supports: new WebSocket(url, ['graphql-ws'])
  • Server must echo back one of the requested subprotocols in the handshake response
javascript3 fixes

WebSocket rate limiting triggered

WebSocket.*flood|rate limit.*WebSocket|too many messages

  • Implement client-side message throttling/debouncing before sending
  • Batch multiple small messages into fewer larger messages
javascript3 fixes

WebSocket connection memory leak on server

WebSocket.*memory.*leak|WebSocket.*connections.*not.*cleaned

  • Remove event listeners when connections close: ws.removeAllListeners() in 'close' handler
  • Clear intervals/timeouts associated with the connection in the close handler
javascript3 fixes

Apollo Client network error - server unreachable

Network error.*Failed to fetch|ApolloError.*Network error

  • Check that the GraphQL endpoint URL is correct and the server is running
  • Add an error link to the Apollo Client link chain: onError(({ networkError }) => { ... })
javascript3 fixes

Apollo cache inconsistency - missing typename or field

Cache data may be lost.*__typename|Missing field '(.*)' while writing result

  • Ensure all queries include __typename (Apollo adds it automatically unless disabled)
  • Define a typePolicies merge function for the conflicting type in InMemoryCache config
javascript3 fixes

Apollo optimistic response shape doesn't match mutation result

Optimistic response.*does not match|optimisticResponse.*type mismatch

  • Ensure optimisticResponse includes __typename for all object types in the response
  • Match the exact shape of the mutation's return type including all queried fields
javascript3 fixes

Apollo subscription disconnected

Subscription.*disconnected|WebSocket.*closed.*subscription|Observable cancelled

  • Configure WebSocket reconnection in the subscription client: connectionParams with retry logic
  • Use graphql-ws library (maintained) instead of subscriptions-transport-ws (deprecated)
javascript3 fixes

GraphQL schema stitching type conflict

Schema stitching.*type conflict|Cannot merge.*different types|Type.*mismatch.*subschema

  • Use transforms to rename conflicting types: RenameTypes((name) => `Service_${name}`)
  • Define explicit type merging config in stitchSchemas for shared types
javascript3 fixes

GraphQL variable type mismatch

Variable.*got invalid value|Variable.*expected.*type.*but got

  • Check that variable values match their declared types in the operation definition
  • Ensure enums are passed as strings without quotes in the variables object (not the query)
javascript3 fixes

GraphQL field does not exist on type

Cannot query field.*on type|Field.*doesn't exist on type

  • Check for typos in field names — GraphQL is case-sensitive
  • If querying a union/interface, use inline fragments: ... on SpecificType { field }
javascript3 fixes

Apollo cache reset while queries are active

Store reset while query was in flight|client\.resetStore.*active queries

  • Use client.clearStore() instead of client.resetStore() if you don't need to refetch
  • Wait for active queries to complete before resetting: await Promise.all then resetStore
javascript3 fixes

Apollo cache circular reference during serialization

Maximum call stack.*circular|Circular reference.*serializing

  • Define custom cache key fields in typePolicies to prevent circular normalization
  • Use cache.evict() to remove circular references before extracting cache state
javascript3 fixes

GraphQL query syntax error

400 Bad Request.*query.*parse error|Syntax Error.*GraphQL

  • Validate queries at build time using graphql-eslint or graphql-codegen
  • Check for missing closing braces, invalid field names, or incorrect fragment syntax
javascript3 fixes

Apollo expecting parsed document but got raw string

Invariant Violation.*Expecting a parsed GraphQL document|not a valid GraphQL document

  • Wrap your query string in the gql template tag: import { gql } from '@apollo/client'
  • If using .graphql files, configure webpack/vite graphql-tag/loader
javascript3 fixes

Apollo fetchMore pagination cache merge failing

fetchMore.*could not find.*in cache|updateQuery.*merge.*not working

  • Define a typePolicies merge function for the paginated field: merge(existing, incoming, { args })
  • Use the keyArgs option to specify which arguments identify unique cache entries
javascript3 fixes

GraphQL subscription error not handled

Unhandled GraphQL subscription error|onError.*subscription.*payload

  • Add an error callback to the subscription: subscribe({ next, error: (err) => handle(err) })
  • Handle errors in the subscription link: new GraphQLWsLink with on: { error: handler }
javascript3 fixes

GraphQL query complexity/depth limit exceeded

query.*exceeded.*complexity|Query is too complex.*cost

  • Reduce query depth by splitting into multiple simpler queries
  • Request pagination with smaller page sizes to reduce response complexity
javascript3 fixes

GraphQL non-nullable field returned null

Cannot return null for non-nullable field|null.*non-null

  • Fix the resolver to always return a value for non-nullable fields
  • If null is a valid state, change the schema to make the field nullable: field: String → field: String!
javascript3 fixes

Apollo persisted query hash not found on server

PersistedQueryNotFound|Persisted query.*not found.*hash

  • Enable Automatic Persisted Queries (APQ): server will request the full query on first miss
  • Ensure the client is configured with createPersistedQueryLink() in the link chain
javascript3 fixes

GraphQL server doesn't support persisted queries

PERSISTED_QUERY_NOT_SUPPORTED|persistedQuery.*not supported

  • Disable APQ on the client: remove persistedQueryLink from the Apollo link chain
  • Enable APQ on the server: new ApolloServer({ persistedQueries: { cache } })
javascript3 fixes

Apollo query callback fires after component unmount

useLazyQuery.*called.*unmounted|update.*unmounted component.*Apollo

  • Use the cleanup return from useEffect to cancel or ignore stale results
  • Check if the component is still mounted before updating state in onCompleted callback
javascript3 fixes

Apollo received non-200 HTTP status from server

ApolloError.*Response not successful.*status code (4|5)\d{2}

  • Check the server logs for the actual error — the response body usually contains GraphQL error details
  • Add an HTTP link error handler to parse and display the error message
javascript3 fixes

GraphQL fragment type mismatch or duplication

Duplicate.*__typename.*fragment|Fragments.*cannot.*spread.*different types

  • Ensure the fragment's type condition matches the field's type: ...FragName on CorrectType
  • Use inline fragments for union types: ... on TypeA { fieldA } ... on TypeB { fieldB }
javascript4 fixes

Cannot read property of null/undefined

TypeError:.*Cannot read propert(y|ies) of (null|undefined)

  • Add optional chaining (?.) before the property access
  • Add a null check before accessing the property
javascript4 fixes

Value is not a function

TypeError:.*is not a function

  • Check that the variable holds a function and not undefined/null
  • Verify the import path and that the function is exported correctly
javascript3 fixes

Assignment to constant variable

TypeError:.*Assignment to constant variable

  • Change `const` to `let` if the variable needs reassignment
  • Use a new variable instead of reassigning the constant
javascript4 fixes

Value is not iterable

TypeError:.*is not iterable

  • Ensure the value is an array or iterable before using for...of or spread
  • Provide a default empty array: `value || []`
javascript3 fixes

Cannot set property of null/undefined

TypeError:.*Cannot set propert(y|ies) of (null|undefined)

  • Initialize the object before setting properties on it
  • Add a null check before the assignment
javascript3 fixes

Cannot convert undefined/null to object

TypeError:.*Cannot convert (undefined|null) to object

  • Provide a fallback value: `Object.keys(value || {})`
  • Check for null/undefined before passing to Object.keys, Object.assign, etc.
javascript4 fixes

Variable is not defined

ReferenceError:.*is not defined

  • Import or declare the variable before using it
  • Check for typos in the variable name
javascript3 fixes

Cannot access variable before initialization (TDZ)

ReferenceError:.*Cannot access .* before initialization

  • Move the variable declaration before its first usage
  • Check for circular dependencies between modules
javascript4 fixes

Unexpected token

SyntaxError:.*Unexpected token

  • Check for missing commas, brackets, or parentheses near the reported line
  • Ensure JSON files don't have trailing commas or comments
javascript3 fixes

Invalid regular expression

SyntaxError:.*Invalid regular expression

  • Escape special regex characters: . * + ? ^ $ { } ( ) | [ ] \
  • When using `new RegExp()`, double-escape backslashes: `\\d` instead of `\d`
javascript4 fixes

JSON parse error

SyntaxError:.*JSON\.parse|Unexpected (token|end of JSON|number|string) (in JSON )?at position

  • Validate the JSON string with a linter or JSON.parse in try/catch
  • Check for trailing commas, single quotes, or unquoted keys
javascript4 fixes

Maximum call stack size exceeded (infinite recursion)

RangeError:.*Maximum call stack size exceeded

  • Add a base case to your recursive function to stop recursion
  • Check for circular references in objects being serialized (JSON.stringify)
javascript3 fixes

Invalid array length

RangeError:.*Invalid array length

  • Ensure the array length is a non-negative integer
  • Check that the value passed to `new Array()` is not negative or NaN
javascript4 fixes

Invalid Date

RangeError:.*Invalid (time value|date)

  • Validate the date string format before passing to `new Date()`
  • Use ISO 8601 format (YYYY-MM-DD) for cross-browser compatibility
javascript4 fixes

Unhandled promise rejection

Unhandled(PromiseRejection|promise rejection)|UnhandledPromiseRejectionWarning

  • Add `.catch()` to the promise chain
  • Wrap async code in try/catch
javascript3 fixes

Value is not a promise/thenable

TypeError:.*\.then is not a function|is not a (thenable|promise)

  • Ensure the function returns a Promise (add `async` or return `new Promise()`)
  • Check that you're not calling .then() on a synchronous return value
javascript4 fixes

document is not defined (SSR/Node)

ReferenceError:.*document is not defined

  • Guard DOM access with `if (typeof document !== 'undefined')`
  • Move DOM manipulation to lifecycle hooks that only run in the browser (ngAfterViewInit, useEffect)
javascript4 fixes

window is not defined (SSR/Node)

ReferenceError:.*window is not defined

  • Guard with `if (typeof window !== 'undefined')`
  • Use dependency injection to abstract window access
javascript4 fixes

Webpack: Module parse/build failed — missing loader

Module build failed.*loader|Module parse failed|You may need an appropriate loader

  • Install the required loader (e.g., `npm install -D css-loader style-loader`)
  • Add a rule in webpack.config.js for the file type
javascript4 fixes

Vite: Failed to resolve import

\[vite\].*Failed to resolve import|Could not resolve

  • Install the missing dependency: `npm install <package>`
  • Add the path alias to `resolve.alias` in vite.config.ts
javascript4 fixes

esbuild build failure

error\[E0\d+\]|Build failed with \d+ error|✘.*esbuild

  • Check the specific error code and file/line reference in the output
  • Ensure syntax is compatible with the `target` setting in esbuild config
javascript4 fixes

Webpack/build: Bundle size exceeds limit

Chunk \w+ \[\w+\] exceeds.*limit|entrypoint size limit|asset size limit

  • Enable code splitting with dynamic imports: `import('./module')`
  • Analyze the bundle with `webpack-bundle-analyzer` to find large dependencies
javascript4 fixes

Array method called on non-array

TypeError:.*(?:reduce|find|map|filter|forEach) of (empty array|undefined|null)|is not a function

  • Ensure the value is an array before calling array methods
  • Provide a default empty array: `(data || []).map(...)`
javascript4 fixes

Modern method not available (polyfill needed)

TypeError:.*(?:flat|flatMap|replaceAll|at) is not a function

  • Check your Node.js version — upgrade to a version supporting the method
  • Add a polyfill via core-js: `import 'core-js/features/array/flat'`
javascript4 fixes

Circular dependency detected

Circular dependency detected|WARNING.*circular

  • Extract shared code into a third module that both modules can import
  • Use dependency injection or inversion of control to break the cycle