{"record":{"id":"9cc0f351dcf0ad50","repo":"jackwener/OpenCLI","slug":"twitter-profile-response-for-screenname-is-mis-9cc0f3","errorCode":null,"errorMessage":"Twitter profile response for @${screenName} is missing profile identity fields","messagePattern":"Twitter profile response for @(.+?) is missing profile identity fields","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/twitter/profile.js","lineNumber":53,"sourceCode":"        if (typeof value === 'number' && Number.isFinite(value))\n            return value;\n    }\n    return 0;\n}\n\nexport function mapTwitterProfileResult(result, screenName) {\n    if (!isPlainObject(result)) {\n        throw new CommandExecutionError(`Twitter profile response for @${screenName} is malformed`);\n    }\n    const hasLegacy = isPlainObject(result.legacy);\n    const hasCore = isPlainObject(result.core);\n    if (!hasLegacy && !hasCore) {\n        throw new CommandExecutionError(`Twitter profile response for @${screenName} is missing profile fields`);\n    }\n    const legacy = hasLegacy ? result.legacy : {};\n    const core = hasCore ? result.core : {};\n    if (!stringField(core.screen_name) && !stringField(legacy.screen_name) && !stringField(core.name) && !stringField(legacy.name) && !stringField(core.created_at) && !stringField(legacy.created_at)) {\n        throw new CommandExecutionError(`Twitter profile response for @${screenName} is missing profile identity fields`);\n    }\n    const location = isPlainObject(result.location) ? result.location : {};\n    const expandedUrl = stringField(result.website?.url) || stringField(legacy.entities?.url?.urls?.[0]?.expanded_url);\n    return [{\n        screen_name: stringField(core.screen_name) || stringField(legacy.screen_name) || screenName,\n        name: stringField(core.name) || stringField(legacy.name),\n        bio: stringField(result.profile_bio?.description) || stringField(legacy.description),\n        location: stringField(location.location) || stringField(legacy.location),\n        url: stringField(expandedUrl),\n        followers: countField(result.relationship_counts?.followers, legacy.followers_count, legacy.normal_followers_count),\n        following: countField(result.relationship_counts?.following, legacy.friends_count),\n        tweets: countField(result.tweet_counts?.tweets, legacy.statuses_count),\n        likes: countField(result.action_counts?.favorites_count, legacy.favourites_count),\n        verified: Boolean(result.is_blue_verified || result.verification?.verified || legacy.verified),\n        created_at: stringField(core.created_at) || stringField(legacy.created_at),\n    }];\n}\n","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/twitter/profile.js#L35-L71","documentation":"CommandExecutionError thrown by mapTwitterProfileResult when the response has legacy/core objects but none of the identity fields (screen_name, name, created_at) are present in either — the payload is structurally recognizable but carries no usable identity data.","triggerScenarios":"result.legacy and result.core both exist but every one of core.screen_name, legacy.screen_name, core.name, legacy.name, core.created_at, legacy.created_at is absent/not a string — e.g. a truncated or redacted user object, or X moved identity fields elsewhere.","commonSituations":"X adding a new container and emptying legacy/core; country-withheld or restricted accounts returning stripped objects; caching layers returning partial payloads; pagination/selection grabbing the wrong object.","solutions":["Refresh the session and retry — cached partial payloads can resolve on a fresh request","Check whether the account is withheld/restricted in your region","Dump the raw response in the browser (or via a debug flag) to see where identity fields moved","If identity fields relocated to a new container, update mapTwitterProfileResult to read them"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"function hasIdentityFields(core, legacy) {\n  const s = (v) => typeof v === 'string' && v.length > 0;\n  return [core?.screen_name, legacy?.screen_name, core?.name,\n          legacy?.name, core?.created_at, legacy?.created_at].some(s);\n}","tryCatchPattern":"try {\n  const profile = await opencli('twitter profile', { username });\n} catch (e) {\n  if (e.name === 'CommandExecutionError' && /missing profile identity fields/.test(e.message)) {\n    console.warn('Payload had legacy/core but no identity data — likely restricted/withheld account');\n  } else throw e;\n}","preventionTips":["Check whether the account is region-withheld or restricted","Refetch with a fresh session to rule out cached partial payloads","Inspect the raw response once to see where X moved identity fields","Handle fallback display of '@handle' when identity fields are absent"],"tags":["twitter","api-response","schema"],"backgroundTag":"api-response-schema-mismatch","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}