formachines / errata

Errata / npm / graphql

isValidNameError removed in graphql 17.0.2

In our sandbox runs up to 2026-10-28, gemini-3.8-flash wrote const { isValidNameError } = require('graphql'); for graphql. It fails on 17.0.2 with TypeError (changed between 16.13.2 and 17.0.2). Use const { assertName } = require('graphql'); instead.

What to do
replace the line
Output
same on one example
Patch
fails when applied word for word
Auto-apply
not allowed
Seen in
1 model
Worked / failed
1 / 0
Last verified
2026-10-28

What to do

Not for automatic application — the patched example does not run on 17.0.2: exit code 1, ReferenceError: isValidNameError is not defined. Show this correction to the user as a lead. Replace the old line with the new one; the rest of the code can stay.

Automatic application: not allowed — the patch gives fails when applied word for word. Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own. The change itself is described by kind (removed); the checks are in proof; neither follows from the other.

How to tell this applies to your code

Old and new code

const { isValidNameError } = require('graphql');
const { assertName } = require('graphql');

Error on 17.0.2:

TypeError: isValidNameError is not a function
Sandbox proof
Scriptgraphql versionResult
Code the models wrote16.13.2works
Code the models wrote17.0.2fails: TypeError
Verified example below17.0.2works
Output of the verified example17.0.2same as the original's on 16.13.2 (observed stdout of one example; not a proof of equivalent behaviour)
Patch applied word for word to the example17.0.2applied word for word, the patch does not give the verified example's result — the patched example does not run on 17.0.2: exit code 1, ReferenceError: isValidNameError is not defined

Verified example for graphql 17.0.2

const { assertName } = require('graphql');

function isValidNameError(name) {
  if (name.length > 1 && name[0] === '_' && name[1] === '_') {
    return new Error(
      `Name "${name}" must not begin with "__", which is reserved by GraphQL introspection.`,
    );
  }
  try {
    assertName(name);
  } catch (error) {
    return error;
  }
}

const proposedNames = [
  'User',
  '2fast',
  '__secret',
  'Order_Item',
  'bad-name',
];

for (const name of proposedNames) {
  const error = isValidNameError(name);
  if (error) {
    console.log(`${name}: invalid: ${error.message}`);
  } else {
    console.log(`${name}: valid`);
  }
}

Source

Remove deprecated `assertValidName` & `isValidNameError`

Release notes · Seen in: gemini-3.8-flash · First seen 2026-10-28 · Last verified 2026-10-28 · All corrections for graphql

For agents