hcengineering/platform · info

Not Found

Error message

Not Found

What it means

The catch-all middleware responds 404 with JSON { message: 'Not Found' } for any request that did not match a previously defined route or static handler. It is the terminal fallback of the backup API's router, not an exceptional condition — the requested URL simply has no handler.

Source

Thrown at services/backup/backup-api-pod/src/server.ts:431

      if (err instanceof TokenError) {
        res.status(401).send()
        return
      }
      ctx.error('statistics error', { err })
      Analytics.handleError(err)
      res.status(404).send()
    }
  })

  app.get('/', (_req, res) => {
    res.send(`
      Huly® Datalake™ <a href="https://huly.io">https://huly.io</a>
      © 2025 <a href="https://hulylabs.com">Huly Labs</a>
    `)
  })

  app.use((_req, res) => {
    res.status(404).json({ message: 'Not Found' })
  })

  return {
    app,
    close: () => {
      clearInterval(wsInfoCacheInterval)
    }
  }
}

export function listen (e: Express, port: number, host?: string): Server {
  const cb = (): void => {
    console.log(`Service started at ${host ?? '*'}:${port}`)
  }

  const server = host !== undefined ? e.listen(port, host, cb) : e.listen(port, cb)
  server.keepAliveTimeout = KEEP_ALIVE_TIMEOUT * 1000 + 1000
  server.headersTimeout = KEEP_ALIVE_TIMEOUT * 1000 + 2000

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Use one of the defined routes: GET /api/backup/:workspace/:file(*), GET /api/v1/statistics?token=..., or GET /
  2. Fix typos in the URL path and confirm the HTTP method is GET
  3. Check the service version exposes the endpoint you expect
  4. For health checks, probe GET / instead of an invented path

Example fix

// before
await fetch('https://backup.example.com/api/backup') // missing workspace/file
// after
await fetch(`https://backup.example.com/api/backup/${workspaceUuid}/index.json`, { headers: { Authorization: `Bearer ${token}` } })
Defensive patterns

Strategy: validation

Validate before calling

const KNOWN = [/^\/api\/backup\/[^/]+\/.+$/, /^\/api\/v1\/statistics$/, /^\/$/]
if (!KNOWN.some((re) => re.test(url.pathname))) throw new Error(`Unknown backup API path: ${url.pathname}`)

Type guard

function isKnownBackupPath(pathname: string): boolean {
  return pathname === '/' || pathname.startsWith('/api/backup/') || pathname === '/api/v1/statistics'
}

Try / catch

const res = await fetch(url)
if (res.status === 404) {
  const body = await res.json().catch(() => null)
  if (body?.message === 'Not Found') throw new Error(`No such endpoint: ${url}`)
}

Prevention

When it happens

Trigger: Requesting an undefined path such as GET /api/backup (no workspace/file), wrong HTTP method on a defined path (only GET routes exist here), or typos like /api/v2/statistics.

Common situations: Clients guessing API paths, health checkers probing endpoints that were removed, or frontends calling an endpoint renamed between service versions.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/a518165744b8d431. Report an issue: GitHub.