moeru-ai/airi · error · Error

Tweet ID is empty. Please provide a tweet ID to retweet.

Error message

Tweet ID is empty. Please provide a tweet ID to retweet.

What it means

Thrown by handleRetweet when the parsed command's content is falsy — i.e. 'retweet:' was sent with no tweet id. This is a plain Error raised before retweet() is invoked, so no browser action runs.

Source

Thrown at integrations/twitter-services/src/adapters/airi-adapter.ts:178

  }

  private async handleLikeTweet(content: string): Promise<void> {
    if (content) {
      await this.twitterServices.tweet.likeTweet(content)
      logger.main.log(`Liked tweet: ${content}`)
    }
    else {
      throw new Error('Tweet ID is empty. Please provide a tweet ID to like.')
    }
  }

  private async handleRetweet(content: string): Promise<void> {
    if (content) {
      await this.twitterServices.tweet.retweet(content)
      logger.main.log(`Retweeted: ${content}`)
    }
    else {
      throw new Error('Tweet ID is empty. Please provide a tweet ID to retweet.')
    }
  }

  private async handleGetUser(content: string): Promise<boolean> {
    if (content) {
      const userProfile = await this.twitterServices.user.getUserProfile(content)
      logger.main.log(`Retrieved profile for user: @${content}`)
      // Return user info to the user
      this.client.send({
        type: 'input:text',
        data: {
          text: `User Profile for @${userProfile.username}:
Display Name: ${userProfile.displayName}
Bio: ${userProfile.bio || 'N/A'}
Followers: ${userProfile.followersCount || 0}
Following: ${userProfile.followingCount || 0}`,
        },
      })

View on GitHub (pinned to 27111382b4)

Solutions

  1. Provide a non-empty tweet id (or status URL) after 'retweet:'.
  2. Validate content in the parser and reprompt for the id before dispatch.
  3. Have the adapter reply with usage guidance instead of throwing.

Example fix

// before
if (content) { await this.twitterServices.tweet.retweet(content) } else {
  throw new Error('Tweet ID is empty. Please provide a tweet ID to retweet.')
}

// after
const id = content?.trim()
if (!id) {
  this.client.send({ type: 'input:text', data: { text: 'Usage: retweet: <tweetId>' } })
  return
}
Defensive patterns

Strategy: validation

Validate before calling

const id = (content ?? '').trim()
if (!id) {
  throw new Error('Tweet ID required')
}
await adapter.handleRetweet(id)

Type guard

function isEmptyRetweetIdError(e: unknown): boolean {
  return e instanceof Error && /tweet ID to retweet/i.test(e.message)
}

Try / catch

try {
  await this.handleRetweet(content)
} catch (e) {
  if (e instanceof Error && /tweet ID to retweet/i.test(e.message)) {
    this.client.send({ type: 'input:text', data: { text: 'Usage: retweet: <tweetId>' } })
  } else throw e
}

Prevention

When it happens

Trigger: User sends 'retweet:' with nothing after the colon; parseTwitterCommand matched the 'retweet' prefix but content is empty/whitespace.

Common situations: User forgot to paste the tweet id/status URL; LLM truncated the payload; empty input forwarded by the AIRI input:text event.

Related errors


AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12). Data as JSON: /api/errors/f35276e015f63b8b. Report an issue: GitHub.