{"record":{"id":"967986b2545463e6","repo":"cline/cline","slug":"mcp-server-servername-did-not-start-an-oauth","errorCode":null,"errorMessage":"MCP server \"${serverName}\" did not start an OAuth stateful authorization flow.","messagePattern":"MCP server \"(.+?)\" did not start an OAuth stateful authorization flow\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"sdk/packages/core/src/extensions/mcp/oauth.ts","lineNumber":614,"sourceCode":"\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`MCP server \"${serverName}\" OAuth authorization was cancelled.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Timed out waiting for MCP OAuth authorization callback.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (callback.error) {\n\t\t\t\tthrow new Error(`OAuth authorization failed: ${callback.error}`);\n\t\t\t}\n\t\t\tif (!callback.code) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"OAuth callback did not include an authorization code.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst expectedState = oauthContext.getLastOAuthState();\n\t\t\tif (!expectedState) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`MCP server \"${serverName}\" did not start an OAuth stateful authorization flow.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (callback.state !== expectedState) {\n\t\t\t\tthrow new Error(\"OAuth authorization failed: state mismatch.\");\n\t\t\t}\n\n\t\t\tawait transport.finishAuth(callback.code);\n\t\t\tretryClient = buildClient(options);\n\t\t\tconst retryTransport = createMcpSdkTransport({\n\t\t\t\tregistration,\n\t\t\t\toauthProvider: oauthContext.provider,\n\t\t\t\tfetch: options.fetch,\n\t\t\t});\n\t\t\tawait retryClient.connect(retryTransport, {\n\t\t\t\ttimeout: requestTimeoutMs,\n\t\t\t\tsignal: options.signal,\n\t\t\t});","sourceCodeStart":596,"sourceCodeEnd":632,"githubUrl":"https://github.com/cline/cline/blob/491b30b806fdb8c93513f821f2b87d63a61542f5/sdk/packages/core/src/extensions/mcp/oauth.ts#L596-L632","documentation":"Error \"MCP server \"${serverName}\" did not start an OAuth stateful authorization flow.\" thrown in cline/cline.","triggerScenarios":"Thrown at sdk/packages/core/src/extensions/mcp/oauth.ts:614 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":"491b30b806fdb8c93513f821f2b87d63a61542f5","analyzedAt":"2026-08-25T13:45:22.367Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}