{"record":{"id":"76a7e0486cd20640","repo":"n8n-io/n8n","slug":"prefer-predefined-credential","errorCode":"PREFER_PREDEFINED_CREDENTIAL","errorMessage":"This request targets a service with a dedicated n8n credential (\"${resolution.credentialType}\"). Use authentication: \"predefinedCredentialType\" with nodeCredentialType: \"${resolution.credentialType}\" instead of a generic credential.","messagePattern":"This request targets a service with a dedicated n8n credential \\(\"(.+?)\"\\)\\. Use authentication: \"predefinedCredentialType\" with nodeCredentialType: \"(.+?)\" instead of a generic credential\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/src/tools/workflows/workflow-source-compiler.ts","lineNumber":332,"sourceCode":"\tcontext: InstanceAiContext,\n): Promise<ValidationWarning[]> {\n\tconst hosts = await context.credentialService.listHttpCredentialHosts?.();\n\tif (!hosts?.length) return [];\n\n\tconst index = buildCredentialHostIndex(hosts);\n\tconst warnings: ValidationWarning[] = [];\n\n\tfor (const node of json.nodes ?? []) {\n\t\tif (node.type !== HTTP_REQUEST_NODE_TYPE) continue;\n\t\tconst params = node.parameters;\n\t\tif (!isRecord(params) || params.authentication !== 'genericCredentialType') continue;\n\t\tconst url = typeof params.url === 'string' ? params.url : '';\n\t\tif (!url) continue;\n\n\t\tconst resolution = resolveCredentialByUrl(url, index);\n\t\tif (resolution.status === 'match') {\n\t\t\twarnings.push({\n\t\t\t\tcode: 'PREFER_PREDEFINED_CREDENTIAL',\n\t\t\t\tnodeName: node.name,\n\t\t\t\tmessage: `This request targets a service with a dedicated n8n credential (\"${resolution.credentialType}\"). Use authentication: \"predefinedCredentialType\" with nodeCredentialType: \"${resolution.credentialType}\" instead of a generic credential.`,\n\t\t\t});\n\t\t} else if (resolution.status === 'ambiguous') {\n\t\t\twarnings.push({\n\t\t\t\tcode: 'PREFER_PREDEFINED_CREDENTIAL',\n\t\t\t\tnodeName: node.name,\n\t\t\t\tmessage: `This request targets a service with dedicated n8n credentials (${resolution.candidates.join(', ')}). Prefer authentication: \"predefinedCredentialType\" with the matching nodeCredentialType.`,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn warnings;\n}\n\nexport async function compileWorkflowSource(\n\tcontext: InstanceAiContext,\n\tfilePath: string,","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/src/tools/workflows/workflow-source-compiler.ts#L314-L350","documentation":"Error \"This request targets a service with a dedicated n8n credential (\"${resolution.credentialType}\"). Use authentication: \"predefinedCredentialType\" with nodeCredentialType: \"${resolution.credentialType}\" instead of a generic credential.\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/instance-ai/src/tools/workflows/workflow-source-compiler.ts:332 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}