{"record":{"id":"586ffec57bb33398","repo":"n8n-io/n8n","slug":"the-marker-redactedkey-was-not-found","errorCode":null,"errorMessage":"The marker \"${redactedKey}\" was not found.","messagePattern":"The marker \"(.+?)\" was not found\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/mcp-browser/src/tools/credential.ts","lineNumber":77,"sourceCode":"\t\tconnection,\n\t\t'browser_capture_secret',\n\t\t'Read a secret value from a DOM element (identified by a snapshot ref) and store it in the session buffer. The value is never returned to the LLM. Use browser_create_credential to assemble buffered secrets into a credential.',\n\t\tbrowserCaptureSecretSchema,\n\t\tasync (state, args, pageId, context) => {\n\t\t\trequireSecretsBuffer(context);\n\t\t\tlet value = '';\n\t\t\tif ('redactedKey' in args.element) {\n\t\t\t\tconst { redactedKey } = args.element;\n\t\t\t\tconst sensitivity = analyzeHtmlSensitivity(await state.adapter.probePageHtml(pageId));\n\t\t\t\tif (sensitivity.ok) {\n\t\t\t\t\tconst formatMarker = createRedactionMarkerFormatter(sensitivity.hits);\n\t\t\t\t\tconst markerMap = sensitivity.hits.reduce((result, hit) => {\n\t\t\t\t\t\tresult.set(formatMarker(hit), hit.value);\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}, new Map<string, string>());\n\n\t\t\t\t\tif (!markerMap.get(redactedKey)) {\n\t\t\t\t\t\tthrow new Error(`The marker \"${redactedKey}\" was not found.`);\n\t\t\t\t\t}\n\t\t\t\t\tvalue = markerMap.get(redactedKey)!;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(`Secret capturing failed with error: ${sensitivity.error}`);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvalue = await state.adapter.getElementValue(pageId, { ref: args.element.ref });\n\t\t\t}\n\t\t\tcontext.secretsBuffer.capture(args.credentialsKey, args.field, value);\n\t\t\treturn formatCallToolResult({ ok: true, fieldsCaptured: [args.field] });\n\t\t},\n\t\tundefined,\n\t\t{ skipEnrichment: true },\n\t);\n}\n\n// ---------------------------------------------------------------------------\n// browser_create_credential","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/mcp-browser/src/tools/credential.ts#L59-L95","documentation":"Thrown by browser_capture_secret when the redactedKey supplied does not match any marker in the markerMap built from the page's sensitivity hits. The tool probes the page HTML, analyzes it for secret-bearing fields, formats each hit as a redaction marker, and looks up the requested key; a miss means the key is not present in the current page content.","triggerScenarios":"Passing a redactedKey (e.g. \"[REDACTED:password:1]\") that does not correspond to any sensitivity hit on the current page. Common when the key was read from a stale snapshot, the page changed, or the key format doesn't match createRedactionMarkerFormatter output.","commonSituations":"Page navigated or re-rendered after the snapshot that produced the redactedKey. Using a key from a different pageId. Marker format mismatch (formatter changed between versions). Secret field is in a shadow DOM or iframe the HTML probe didn't reach.","solutions":["Re-run browser_snapshot with { interactive: false } to refresh the list of redacted keys, then use a key from the new snapshot.","Ensure the pageId matches the page containing the secret element.","Verify the redactedKey string exactly matches the format returned by the snapshot (including brackets and index)."],"exampleFix":"// before — stale redactedKey\nawait captureSecret({ redactedKey: '[REDACTED:password:1]', ... }); // throws\n\n// after — refresh snapshot, use a current key\nconst snap = await snapshot({ interactive: false });\nawait captureSecret({ redactedKey: snap.redactedKeys[0], ... });","handlingStrategy":"validation","validationCode":"const sensitivity = analyzeHtmlSensitivity(await adapter.probePageHtml(pageId));\nif (!sensitivity.ok) throw new Error(sensitivity.error);\nconst marker = createRedactionMarkerFormatter(sensitivity.hits);\nconst valid = new Set(sensitivity.hits.map(marker));\nif (!valid.has(redactedKey)) { /* refresh snapshot, pick a valid key */ }","typeGuard":"function markerExists(hits: SensitivityHit[], key: string): boolean {\n  const fmt = createRedactionMarkerFormatter(hits);\n  return hits.some((h) => fmt(h) === key);\n}","tryCatchPattern":"try {\n  await captureSecret({ redactedKey, ... });\n} catch (e) {\n  if (/marker .* was not found/.test(e.message)) {\n    const snap = await snapshot({ interactive: false });\n    await captureSecret({ redactedKey: snap.redactedKeys[0], ... });\n  } else throw e;\n}","preventionTips":["Always re-snapshot with { interactive: false } before capturing non-interactive secrets.","Use a key returned by the most recent snapshot, never a hardcoded or stale one.","Confirm the pageId contains the secret element before capturing."],"tags":["credential","redacted-key","sensitivity","snapshot"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}