{"record":{"id":"51c90755e69846f0","repo":"lyswhut/lx-music-desktop","slug":"missing-auth-code","errorCode":null,"errorMessage":"Missing auth code","messagePattern":"Missing auth code","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/modules/sync/client/auth.ts","lineNumber":83,"sourceCode":"  // eslint-disable-next-line @typescript-eslint/promise-function-async\n  return request(`${urlInfo.httpProtocol}//${urlInfo.hostPath}/ah`, { headers: { i: keyInfo.clientId, m: msg } }).then(({ text, code }) => {\n    if (code != 200) throw new Error(SYNC_CODE.authFailed)\n\n    let msg\n    try {\n      msg = aesDecrypt(text, keyInfo.key)\n    } catch (err: any) {\n      log.error('[auth] keyAuth decryptMsg error', err.message)\n      throw new Error(SYNC_CODE.authFailed)\n    }\n    if (msg != SYNC_CODE.helloMsg) return Promise.reject(new Error(SYNC_CODE.authFailed))\n  })\n}\n\nconst auth = async(urlInfo: LX.Sync.Client.UrlInfo, serverId: string, authCode?: string) => {\n  if (authCode) return codeAuth(urlInfo, serverId, authCode)\n  const keyInfo = await getSyncAuthKey(serverId)\n  if (!keyInfo) throw new Error(SYNC_CODE.missingAuthCode)\n  await keyAuth(urlInfo, keyInfo)\n  return keyInfo\n}\n\nexport default async(urlInfo: LX.Sync.Client.UrlInfo, authCode?: string) => {\n  console.log('connect: ', urlInfo.href, authCode)\n  if (!await hello(urlInfo)) throw new Error(SYNC_CODE.connectServiceFailed)\n  const serverId = await getServerId(urlInfo)\n  if (!serverId) throw new Error(SYNC_CODE.getServiceIdFailed)\n  return auth(urlInfo, serverId, authCode)\n}\n","sourceCodeStart":65,"sourceCodeEnd":95,"githubUrl":"https://github.com/lyswhut/lx-music-desktop/blob/9c364b482e5621a1d38b50e8610d2fb974457e6e/src/main/modules/sync/client/auth.ts#L65-L95","documentation":"Error \"Missing auth code\" thrown in lyswhut/lx-music-desktop.","triggerScenarios":"Thrown at src/main/modules/sync/client/auth.ts:83 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":"9c364b482e5621a1d38b50e8610d2fb974457e6e","analyzedAt":"2026-08-12T15:14:48.244Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}