PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/System Design/Meta

Design input validation and error handling

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's competency in designing APIs, input validation, structured error handling, operational guardrails, observability, security controls, and testing for a Top-K frequency service.

  • hard
  • Meta
  • System Design
  • Software Engineer

Design input validation and error handling

Company: Meta

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Technical Screen

Design the API and system-level input validation and error-handling strategy for a service that computes the top-k most frequent elements in an input array. Specify the request/response schema, limits (payload size, k bounds, element domains), idempotency, authentication, rate limits, timeouts, and error taxonomy (client vs. server errors). Describe validation layers (client, gateway, service), schema enforcement, partial-failure behavior, observability (metrics, logs, traces), and safeguards for malformed/poisoned payloads. Explain how you would test and monitor this in production.

Quick Answer: This question evaluates a candidate's competency in designing APIs, input validation, structured error handling, operational guardrails, observability, security controls, and testing for a Top-K frequency service.

Related Interview Questions

  • Design an Online Game Leaderboard - Meta (hard)
  • Design an Instagram-like Media Feed - Meta (medium)
  • Design an Online Judge and Live Comments - Meta (medium)
  • Design an Instagram-like platform - Meta (medium)
  • Design a Coding Contest Platform - Meta (medium)
Meta logo
Meta
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
System Design
2
0

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

Context

Design a production-grade service that, given an array of elements, returns the top-k most frequent values. Focus specifically on API design, input validation, and error handling, with clear operational guardrails.

Requirements

  1. Define the API surface:
    • Request/response schema, including versioning and content types.
    • Limits: payload size, bounds on k, element type domains and sizes.
    • Idempotency semantics and request deduplication.
    • Authentication and authorization.
    • Rate limits and quotas.
    • Timeouts and service-level objectives.
    • Error taxonomy: classify client vs. server errors and include structured error responses.
  2. Describe validation layers and schema enforcement:
    • Client-side validation expectations.
    • Gateway/WAF validation and protections.
    • Service-level validation and enforcement.
    • How partial-failure behavior should work (e.g., invalid elements in the array).
  3. Observability and safety:
    • Metrics, logs, and distributed traces.
    • Safeguards for malformed or adversarial payloads (e.g., large, deeply nested, high-cardinality inputs).
  4. Testing and production readiness:
    • How you would test the system pre-deployment (unit, integration, fuzz, property-based).
    • How you would monitor, alert, and run this safely in production.

Assume synchronous processing for modest requests, with an option to propose an asynchronous path for larger payloads if needed.

Solution

Show

Comments (0)

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 7,500+ 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.