{"record":{"id":"5058424b83a33db2","repo":"TanStack/query","slug":"the-usage-in-file-filepath-at-line-start-505842","errorCode":null,"errorMessage":"The usage in file \"${filePath}\" at line ${start}:${end} could not be transformed into the new syntax. Please do this manually.","messagePattern":"The usage in file \"(.+?)\" at line (.+?):(.+?) could not be transformed into the new syntax\\. Please do this manually\\.","errorType":"exception","errorClass":"UnknownUsageError","httpStatus":null,"severity":"warning","filePath":"packages/query-codemods/src/v5/remove-overloads/transformers/query-fn-aware-usage-transformer.cjs","lineNumber":112,"sourceCode":"\n  const replacer = (path) => {\n    const node = path.node\n\n    try {\n      // If the given method/function call matches certain criteria, the node doesn't need to be replaced, this step can be skipped.\n      if (canSkipReplacement(node)) {\n        return node\n      }\n\n      const keyProperty = v5Utils.transformArgumentToKey(\n        path,\n        node.arguments[0],\n        config.keyName,\n        filePath,\n      )\n\n      if (!keyProperty) {\n        throw new UnknownUsageError(node, filePath)\n      }\n\n      const parameters = [jscodeshift.objectExpression([keyProperty])]\n      const createdObjectExpression = parameters[0]\n      const secondParameter = node.arguments[1]\n\n      if (secondParameter) {\n        const queryFnProperty = transformArgumentToQueryFunction(\n          path,\n          secondParameter,\n        )\n\n        if (queryFnProperty) {\n          createdObjectExpression.properties.push(queryFnProperty)\n\n          const thirdParameter = node.arguments[2]\n\n          if (utils.isObjectExpression(thirdParameter)) {","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/TanStack/query/blob/159982c80b844487054155c38ffc760fe4208daf/packages/query-codemods/src/v5/remove-overloads/transformers/query-fn-aware-usage-transformer.cjs#L94-L130","documentation":"`UnknownUsageError` from the v5 `remove-overloads` codemod's `query-fn-aware-usage-transformer`. `transformArgumentToKey` returned null for the first argument, meaning it could not derive a `keyProperty`. Unlike the filter-aware transformer, this variant throws immediately because every query it handles is expected to have a derivable key.","triggerScenarios":"A v4 `useQuery`/`useInfiniteQuery` call whose first argument is not convertible to a key property — e.g. a function call, a conditional, a logical expression, a member expression, or a spread element; calls already wrapped in another helper that hides the key.","commonSituations":"Helper functions used to build keys; ternary-computed keys; keys derived from object properties; codemod run on partially-migrated or unusual code.","solutions":["Open the cited file:start:end and convert the call to the object form manually, supplying an explicit `queryKey`.","Simplify the first argument to an array literal or string literal so the codemod can transform it, then re-run.","If a wrapper forwards arguments, inline a concrete key at the call site for the codemod to process.","Re-run the codemod after fixing; track remaining manual sites via the reported file:line."],"exampleFix":"// before\nuseQuery(getKey(id), () => fetchById(id))\n// after (manual)\nuseQuery({ queryKey: getKey(id), queryFn: () => fetchById(id) })","handlingStrategy":"try-catch","validationCode":"// Determine whether transformArgumentToKey would succeed.\nfunction canDeriveKey(node: any): boolean {\n  return ['Literal', 'TemplateLiteral', 'Identifier', 'ArrayExpression'].includes(node?.type)\n}","typeGuard":null,"tryCatchPattern":"try { runRemoveOverloadsCodemod(file) } catch (e) { if (e.name === 'UnknownUsageError') manualQueue.push({ file, loc: e.message }) }","preventionTips":["Inline concrete key literals at query call sites before running the codemod.","Hoist helper-built keys into named `const` arrays the codemod can resolve.","Triage each cited `file:start:end` and migrate manually.","Re-run the codemod after fixes to confirm remaining call sites transform."],"tags":["codemod","v5-migration","remove-overloads","manual-migration","ast"],"backgroundTag":null,"analyzedSha":"159982c80b844487054155c38ffc760fe4208daf","analyzedAt":"2026-08-12T16:21:52.822Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}