moeru-ai/airi · error

Not implemented

Error message

Not implemented

What it means

followUser is an intentional stub: the Twitter user service exposes the function in its interface but has not implemented it, so every call throws 'Not implemented' unconditionally. This is a contract gap rather than a runtime failure.

Source

Thrown at integrations/twitter-services/src/core/services/user.ts:43

 */
export interface UserStats {
  tweets: number
  following: number
  followers: number
}

/**
 * User Link
 */
export interface UserLink {
  type: string
  url: string
  title: string
}

export function useTwitterUserServices(ctx: Context): TwitterService {
  async function followUser(_username: string): Promise<boolean> {
    throw new Error('Not implemented')
  }

  async function getUserProfile(username: string): Promise<UserProfile> {
    try {
    // Navigate to user profile page
      await ctx.page.goto(`${TWITTER_BASE_URL}/${username}`)

      // Wait for profile elements to load
      await ctx.page.waitForSelector('[data-testid="UserName"]')

      // Get display name
      const displayNameElement = await ctx.page.$('[data-testid="UserName"] div span')
      const displayName = displayNameElement ? await displayNameElement.textContent() || username : username

      // Get bio
      const bioElement = await ctx.page.$('[data-testid="UserDescription"]')
      const bio = bioElement ? await bioElement.textContent() : undefined

View on GitHub (pinned to 27111382b4)

Solutions

  1. Do not call followUser until it is implemented; gate the UI/caller on a capability flag.
  2. Implement followUser by navigating to the profile, clicking [data-testid*='follow'], and confirming the button label flips to Following.
  3. If shipping the interface, expose an `isFollowSupported` capability flag so callers can detect the stub.

Example fix

// before
async function followUser(_username: string): Promise<boolean> {
  throw new Error('Not implemented')
}

// after
async function followUser(username: string): Promise<boolean> {
  await ctx.page.goto(`${TWITTER_BASE_URL}/${username}`)
  await ctx.page.waitForSelector('[data-testid="placementTracking"]')
  const followBtn = await ctx.page.$('[data-testid*="follow"]')
  if (!followBtn) return false
  await followBtn.click()
  await ctx.page.waitForFunction(
    `document.querySelector('[data-testid*="follow"]') === null`,
    { timeout: 5000 },
  )
  return true
}
Defensive patterns

Strategy: validation

Validate before calling

const capabilities = { followSupported: false }
if (!capabilities.followSupported) {
  // do not call followUser; surface 'unsupported' to the UI
  throw new Error('followUser is not supported in this build')
}

Type guard

function isFollowImplemented(fn: (...args: any[]) => Promise<unknown>): boolean {
  // inspect the function source: stubs throw immediately without touching ctx
  return !/Not implemented/.test(fn.toString())
}

Try / catch

try {
  await followUser(username)
}
catch (err) {
  if ((err as Error).message === 'Not implemented') {
    // degrade: inform the user follow is unsupported
    return false
  }
  throw err
}

Prevention

When it happens

Trigger: Any caller that invokes followUser(username), regardless of input, hits this throw immediately because the body is `throw new Error('Not implemented')`.

Common situations: A consumer of useTwitterUserServices assumes the full interface is implemented and calls followUser; UI surfaces a Follow button wired to this function; documentation lists follow support that the code does not yet provide.

Related errors


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