moeru-ai/airi · error
Username is empty. Please provide a username to retrieve.
Error message
Username is empty. Please provide a username to retrieve.
What it means
Thrown by handleGetUser when the parsed command's content is falsy — i.e. 'get user:' was sent with no username. This is a plain Error raised before getUserProfile is called, so no profile lookup occurs.
Source
Thrown at integrations/twitter-services/src/adapters/airi-adapter.ts:200
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}`,
},
})
return true
}
else {
throw new Error('Username is empty. Please provide a username to retrieve.')
}
}
private async handleGetTimeline(count: number): Promise<boolean> {
const timelineOptions = { count }
const tweets = await this.twitterServices.timeline.getTimeline(timelineOptions)
logger.main.log(`Retrieved ${tweets.length} tweets from timeline`)
// Return timeline to the user
this.client.send({
type: 'input:text',
data: {
text: `Latest ${tweets.length} tweets from your timeline:
${tweets.map((t: Tweet) => `- ${t.author.displayName}: ${t.text.substring(0, 80)}...`).join('\n')}`,
},
})
return true
}
View on GitHub (pinned to 27111382b4)
Solutions
- Provide a non-empty username after 'get user:'.
- Validate content in the parser and reprompt for the username before dispatch.
- Have the adapter reply with usage guidance instead of throwing.
Example fix
// before
if (content) { /* fetch profile */ } else {
throw new Error('Username is empty. Please provide a username to retrieve.')
}
// after
const user = content?.trim()
if (!user) {
this.client.send({ type: 'input:text', data: { text: 'Usage: get user: <username>' } })
return false
} Defensive patterns
Strategy: validation
Validate before calling
const user = (content ?? '').trim()
if (!user) {
throw new Error('Username required')
}
await adapter.handleGetUser(user) Type guard
function isEmptyUsernameError(e: unknown): boolean {
return e instanceof Error && /Username is empty/.test(e.message)
} Try / catch
try {
await this.handleGetUser(content)
} catch (e) {
if (e instanceof Error && /Username is empty/.test(e.message)) {
this.client.send({ type: 'input:text', data: { text: 'Usage: get user: <username>' } })
} else throw e
} Prevention
- Validate parsed content for the 'get user' command before dispatch.
- Always include the @handle after the prefix.
- Reply with usage hints instead of throwing on empty input.
When it happens
Trigger: User sends 'get user:' with nothing after the colon; parseTwitterCommand matched the 'get user' prefix but content is empty/whitespace.
Common situations: User forgot to type the @handle; LLM truncated the payload; empty input forwarded by the AIRI input:text event.
Related errors
- Tweet text is empty. Please provide text to post.
- Search query is empty. Please provide a query to search.
- Tweet ID is empty. Please provide a tweet ID to like.
- Tweet ID is empty. Please provide a tweet ID to retweet.
- Unknown X command: ${input}. Supported commands: "post tweet
AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12).
Data as JSON: /api/errors/df54b2bdcb5906ae.
Report an issue: GitHub.