PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/System Design/Meta

Handle invalid input at system level

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's competency in designing end-to-end validation, error handling, and operability for a REST API, covering input schema validation, authentication and authorization, rate limiting, idempotency, error classification, partial-failure strategies, timeouts/retries, observability, and graceful degradation in the System Design domain. It is commonly asked to assess how candidates reason about building robust, production-grade services that handle malformed or oversized payloads and partial failures, and it tests practical application of system-level design principles rather than low-level algorithmic implementation.

  • hard
  • Meta
  • System Design
  • Software Engineer

Handle invalid input at system level

Company: Meta

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Technical Screen

Design the end-to-end validation and error-handling strategy for a service endpoint that computes top-K frequent values from a posted array. Cover input schema validation (types, ranges, size limits), authentication/authorization, rate limiting, idempotency, consistent error codes/messages (4xx vs 5xx), partial failures, timeouts/retries, observability (structured logs, metrics, tracing), and graceful degradation for oversized or malformed payloads. Provide example API contracts and sample error responses.

Quick Answer: This question evaluates a candidate's competency in designing end-to-end validation, error handling, and operability for a REST API, covering input schema validation, authentication and authorization, rate limiting, idempotency, error classification, partial-failure strategies, timeouts/retries, observability, and graceful degradation in the System Design domain. It is commonly asked to assess how candidates reason about building robust, production-grade services that handle malformed or oversized payloads and partial failures, and it tests practical application of system-level design principles rather than low-level algorithmic implementation.

Related Interview Questions

  • Design Top-K, Crawler, and Chess Systems - Meta (hard)
  • Design Search And Web Crawling Systems - Meta (medium)
  • Design an Instagram-Style Social Feed - Meta (medium)
  • Design an Online Game Leaderboard - Meta (hard)
  • Design an On-Demand Delivery Platform - Meta (medium)
Meta logo
Meta
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
System Design
1
0

Design: Validation and Error Handling for a Top-K Frequency API

Context

You are designing a REST endpoint that computes the top-K most frequent values from a client-provided array. The focus is on end-to-end validation, robustness, and operability rather than the counting algorithm itself.

Assume the endpoint is:

  • Method: POST
  • Path: /v1/topk
  • Purpose: Given an array of primitive values and an integer K, return the K most frequent values with counts.
  • Values may be strings or numbers; response ordering must be deterministic (by count desc, then value lexicographically).

Requirements

Design the validation and error-handling strategy covering:

  1. Input schema validation (types, ranges, size limits, content-type, compression)
  2. Authentication and authorization
  3. Rate limiting and quotas
  4. Idempotency for safe retries
  5. Consistent error codes and messages (4xx vs 5xx)
  6. Partial failures (e.g., invalid elements) and response strategy
  7. Timeouts and retries (client and server), backoff guidance
  8. Observability (structured logs, metrics, tracing)
  9. Graceful degradation for oversized or malformed payloads (e.g., sampling or approximate results)
  10. Provide example API contracts and sample error responses

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Meta•More Software Engineer•Meta Software Engineer•Meta System Design•Software Engineer System Design
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.