jackwener/OpenCLI · error · CommandExecutionError

Twitter profile response for @${screenName} is missing profi

Error message

Twitter profile response for @${screenName} is missing profile identity fields

What it means

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.

Source

Thrown at clis/twitter/profile.js:53

        if (typeof value === 'number' && Number.isFinite(value))
            return value;
    }
    return 0;
}

export function mapTwitterProfileResult(result, screenName) {
    if (!isPlainObject(result)) {
        throw new CommandExecutionError(`Twitter profile response for @${screenName} is malformed`);
    }
    const hasLegacy = isPlainObject(result.legacy);
    const hasCore = isPlainObject(result.core);
    if (!hasLegacy && !hasCore) {
        throw new CommandExecutionError(`Twitter profile response for @${screenName} is missing profile fields`);
    }
    const legacy = hasLegacy ? result.legacy : {};
    const core = hasCore ? result.core : {};
    if (!stringField(core.screen_name) && !stringField(legacy.screen_name) && !stringField(core.name) && !stringField(legacy.name) && !stringField(core.created_at) && !stringField(legacy.created_at)) {
        throw new CommandExecutionError(`Twitter profile response for @${screenName} is missing profile identity fields`);
    }
    const location = isPlainObject(result.location) ? result.location : {};
    const expandedUrl = stringField(result.website?.url) || stringField(legacy.entities?.url?.urls?.[0]?.expanded_url);
    return [{
        screen_name: stringField(core.screen_name) || stringField(legacy.screen_name) || screenName,
        name: stringField(core.name) || stringField(legacy.name),
        bio: stringField(result.profile_bio?.description) || stringField(legacy.description),
        location: stringField(location.location) || stringField(legacy.location),
        url: stringField(expandedUrl),
        followers: countField(result.relationship_counts?.followers, legacy.followers_count, legacy.normal_followers_count),
        following: countField(result.relationship_counts?.following, legacy.friends_count),
        tweets: countField(result.tweet_counts?.tweets, legacy.statuses_count),
        likes: countField(result.action_counts?.favorites_count, legacy.favourites_count),
        verified: Boolean(result.is_blue_verified || result.verification?.verified || legacy.verified),
        created_at: stringField(core.created_at) || stringField(legacy.created_at),
    }];
}

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Refresh the session and retry — cached partial payloads can resolve on a fresh request
  2. Check whether the account is withheld/restricted in your region
  3. Dump the raw response in the browser (or via a debug flag) to see where identity fields moved
  4. If identity fields relocated to a new container, update mapTwitterProfileResult to read them
Defensive patterns

Strategy: type-guard

Type guard

function hasIdentityFields(core, legacy) {
  const s = (v) => typeof v === 'string' && v.length > 0;
  return [core?.screen_name, legacy?.screen_name, core?.name,
          legacy?.name, core?.created_at, legacy?.created_at].some(s);
}

Try / catch

try {
  const profile = await opencli('twitter profile', { username });
} catch (e) {
  if (e.name === 'CommandExecutionError' && /missing profile identity fields/.test(e.message)) {
    console.warn('Payload had legacy/core but no identity data — likely restricted/withheld account');
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/9cc0f351dcf0ad50. Report an issue: GitHub.