{"record":{"id":"e48f7c663a91ffee","repo":"neoclide/coc.nvim","slug":"unsupported-position-encoding-result-capabiliti","errorCode":null,"errorMessage":"Unsupported position encoding (${result.capabilities.positionEncoding}) received from server ${this.name}","messagePattern":"Unsupported position encoding \\((.+?)\\) received from server (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/language-client/client.ts","lineNumber":1228,"sourceCode":"      const part = new ProgressPart(connection, token)\n      part.begin({ title: `Initializing ${this.id}`, kind: 'begin' })\n      return this.doInitialize(connection, initParams).then(result => {\n        part.done()\n        return result\n      }, (error: Error) => {\n        part.done()\n        return Promise.reject(error)\n      })\n    } else {\n      return this.doInitialize(connection, initParams)\n    }\n  }\n\n  private async doInitialize(connection: Connection, initParams: InitializeParams): Promise<InitializeResult> {\n    try {\n      const result = await connection.initialize(initParams)\n      if (result.capabilities.positionEncoding !== undefined && result.capabilities.positionEncoding !== PositionEncodingKind.UTF16) {\n        throw new Error(`Unsupported position encoding (${result.capabilities.positionEncoding}) received from server ${this.name}`)\n      }\n\n      this._initializeResult = result\n      this.$state = ClientState.Running\n      let textDocumentSyncOptions: TextDocumentSyncOptions | undefined\n      if (Is.number(result.capabilities.textDocumentSync)) {\n        if (result.capabilities.textDocumentSync === TextDocumentSyncKind.None) {\n          textDocumentSyncOptions = {\n            openClose: false,\n            change: TextDocumentSyncKind.None,\n            save: undefined\n          }\n        } else {\n          textDocumentSyncOptions = {\n            openClose: true,\n            change: result.capabilities.textDocumentSync,\n            save: {\n              includeText: false","sourceCodeStart":1210,"sourceCodeEnd":1246,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/language-client/client.ts#L1210-L1246","documentation":"During doInitialize, the client validates the server's InitializeResult: any server that advertises a positionEncoding other than UTF-16 is rejected with this error. The client (like vscode) only supports UTF-16 position encoding, so a server claiming 'utf-8' or 'utf-32' capability is incompatible.","triggerScenarios":"Connecting to a language server whose capabilities.positionEncoding is set to UTF-8 or UTF-32 (per LSP 3.17 spec) — e.g. servers using rust-analyzer's lsp-server crate or other toolkits defaulting to utf-8; server built against newer LSP features while client pins UTF-16.","commonSituations":"Using a cutting-edge server (rust-analyzer with utf-8 position encoding enabled, newer jdtls/helix-ecosystem servers) with coc.nvim; server config enabling `positionEncoding: utf-8` / `offsetEncoding`; LSP 3.17 servers under vim clients that don't negotiate encoding.","solutions":["Configure the server to use UTF-16 offsets (e.g. rust-analyzer: {\"lsp\":{\"positionEncoding\":\"utf-16\"}} or {\"offsetEncoding\":[\"utf-16\"]}).","Downgrade or switch to a server build that doesn't force utf-8 position encoding.","Update coc.nvim — newer versions may support more encodings.","If the server has no encoding option, open an issue upstream or use an alternative server."],"exampleFix":"// before (rust-analyzer config)\n{ \"rust-analyzer.lsp.enable\": true }  // server defaults to utf-8\n\n// after (settings.json of the server)\n// ~/.config/rust-analyzer/settings.json or RA args\n{ \"lsp\": { \"positionEncoding\": \"utf-16\" } }","handlingStrategy":"validation","validationCode":null,"typeGuard":"function supportsUtf16(initResult: InitializeResult): boolean {\n  const enc = initResult.capabilities.positionEncoding\n  return enc === undefined || enc === 1 /* PositionEncodingKind.UTF16 */\n}","tryCatchPattern":"try {\n  await client.start()\n} catch (e) {\n  if (String(e).includes('Unsupported position encoding')) {\n    // reconfigure the server to utf-16 or switch servers\n  }\n}","preventionTips":["Configure servers to use UTF-16 position encoding (rust-analyzer: positionEncoding/offsetEncoding utf-16).","Check the server's LSP version support before adopting 3.17-era servers.","Keep coc.nvim updated for any broadened encoding support.","Test new servers with a minimal config before wiring them into your setup."],"tags":["position-encoding","initialization","protocol-incompatibility","lsp"],"backgroundTag":"unsupported-position-encoding","analyzedSha":"50e974d9692461a69147d5cab146a8d3e439abe4","analyzedAt":"2026-08-31T11:17:23.966Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}