DocumentSTRUCTURE
Version0.1.0-draft
StatusConceptual Overview (Non-normative)
Last Updated2025-12-01

WDP 5-Part Error Code Structure

A comprehensive overview of the Waddling Diagnostic Protocol

Notation Conventions#

This specification uses the following notation conventions throughout:

SymbolMeaningExample
โ†’Transformation or mappingE.Auth.Token.001 โ†’ Xy8Qz
โ†Annotation or commentโ”‚ โ† Part 1: Severity
โ”‚ โ””โ”€Hierarchy/tree structureComponent hierarchy diagrams
โ”Œ โ”€ โ”Box-drawing for diagramsStructure overview boxes
...Continuation/ellipsis001, 002, ... 999
*Wildcard in patternsE.Auth.* (all Auth errors)
[X]Placeholder for value X[SEVERITY.COMPONENT.PRIMARY.SEQUENCE]
โœ… / โŒRecommended / Not recommendedUsage guidance
MUST, SHOULD, MAYRFC 2119 keywordsNormative requirements

Conformance

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

Note: This document is non-normative. Normative requirements are defined in the individual specification parts.

What is WDP?#

The Waddling Diagnostic Protocol (WDP) is a structured, cross-language error coding system that provides both human-readable semantic codes and compact machine-friendly identifiers.

Core Problem

WDP solves a critical problem: How do you create error codes that are both meaningful to developers and efficient for systems?

The 5-Part Structure#

Every WDP error code consists of five parts:

WDP Structure Overview
Severity.Component.Primary.Sequence -> CompactID
    ^         ^        ^        ^          ^
  Part 1    Part 2   Part 3   Part 4    Part 5

Structure Breakdown:

Parts 1-4: Structured Code    |    Part 5: Compact ID
(Human-readable, semantic)    |    (Machine-friendly, efficient)

Complete Example

Full WDP Error Code Example
E.Auth.Token.001 -> Xy8Qz
โ”‚ โ”‚    โ”‚     โ”‚      โ”‚
โ”‚ โ”‚    โ”‚     โ”‚      โ””โ”€ Part 5: Compact ID (5-char hash)
โ”‚ โ”‚    โ”‚     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Part 4: Sequence (specific event)
โ”‚ โ”‚    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Part 3: Primary (failure domain)
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Part 2: Component (system module)
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Part 1: Severity (urgency level)

Both representations identify the same error:

  • Structured code: E.Auth.Token.001 (for humans, logs, debugging)
  • Compact ID: Xy8Qz (for APIs, transmission, databases)

The Five Parts Explained#

Part 1: Severity#

Single character indicating urgency and type

CodeMeaningUse Case
EErrorOperation failed, needs attention
WWarningPotential issue, operation continues
CCriticalSystem-critical failure
BBlockedOperation waiting/blocked
SSuccessOperation succeeded
KCompletedLong-running task finished
IInfoInformational message
TTraceDebug/trace information
HHelpUser assistance needed

Examples: E (Error), W (Warning), S (Success)

See: 1-SEVERITY for complete specification

Part 2: Component#

System module or domain (PascalCase, max 16 characters)

The Component identifies which part of your system produced the error.

Can be:

  • Physical subsystem: Database, Network, FileSystem, Cache
  • Logical module: Auth, Validation, BusinessLogic, Parser
  • Service boundary: UserService, OrderService, PaymentGateway
  • Architectural layer: Api, Domain, Infrastructure

Examples: Auth, Database, TokenValidator, ServiceRegistry

See: 2-COMPONENT for complete specification

Part 3: Primary#

Failure domain within component (PascalCase, max 16 characters)

The Primary field narrows down the specific area within the Component.

Relationship:

Component.Primary
    โ†“        โ†“
Auth.Token           - Token-related authentication errors
Auth.Session         - Session-related authentication errors
Auth.Permission      - Permission-related authentication errors

Database.Connection  - Database connection errors
Database.Query       - Database query errors
Database.Transaction - Database transaction errors

Examples: Token, Connection, Syntax, Parse, Validation

See: 3-PRIMARY for complete specification

Part 4: Sequence#

Specific event identifier

The Sequence uniquely identifies a specific error within the Component.Primary namespace.

Format:

  • Numeric (canonical): 001, 002, 003, ..., 999
  • Named (alias): TOKEN_MISSING, TOKEN_EXPIRED, etc.

Model:

Canonical Identity: 001, 002, 003 (numeric)
       โ†•
Associated Name: TOKEN_MISSING, TOKEN_EXPIRED (semantic)
       โ†•
Display: Can show either or both
       โ†•
Hash: ALWAYS computed from numeric

Examples: 001, 042, 999

See: 4-SEQUENCE for complete specification

Part 5: Compact ID (Hash)#

5-character hash derived from parts 1-4

The Compact ID is a short, deterministic hash of the structured code.

Generation:

Structured Code:  E.Auth.Token.001
       โ†“
Normalize:        E.AUTH.TOKEN.001 (uppercase)
       โ†“
Hash (xxHash64):  [64-bit integer]
       โ†“
Encode (Base62):  Xy8Qz

Properties:

  • 5 characters: Easy to communicate (users can report "error Xy8Qz")
  • Deterministic: Same input always produces same hash
  • Collision-resistant: 916 million possible values (62^5)
  • Cross-language: Same hash across all implementations

See: 5-COMPACT-IDS for complete specification

How the Parts Work Together#

Hierarchical Organization

Severity
  โ””โ”€ Component (e.g., Auth)
      โ”œโ”€ Primary (e.g., Token)
      โ”‚   โ”œโ”€ Sequence 001 (TOKEN_MISSING)
      โ”‚   โ”œโ”€ Sequence 002 (TOKEN_EXPIRED)
      โ”‚   โ””โ”€ Sequence 003 (TOKEN_INVALID)
      โ”‚
      โ”œโ”€ Primary (e.g., Session)
      โ”‚   โ”œโ”€ Sequence 001 (SESSION_MISSING)
      โ”‚   โ””โ”€ Sequence 013 (SESSION_CLOSED)
      โ”‚
      โ””โ”€ Primary (e.g., Permission)
          โ””โ”€ Sequence 008 (PERMISSION_DENIED)

Error Space

Each Component.Primary combination has 999 possible sequences (001-999).

E.Auth.Token.*           - 999 possible token-related errors
E.Auth.Session.*         - 999 possible session-related errors
E.Database.Connection.*  - 999 possible connection-related errors

Total space: (Components ร— Primaries ร— 999) = effectively unlimited

Dual Representation: Structured vs Compact#

WDP provides two ways to represent the same error:

Structured Code (Parts 1-4)

Format: SEVERITY.COMPONENT.PRIMARY.SEQUENCE

Example: E.Auth.Token.001

Use when:

  • Writing logs (human-readable)
  • Debugging (semantic meaning clear)
  • Monitoring dashboards (can filter/group)
  • Code comments (self-documenting)
  • Developer communication

Benefits:

  • Self-documenting
  • Semantic meaning obvious
  • Can grep/filter by component
  • Understandable without lookup

Compact ID (Part 5)

Format: [0-9A-Za-z]{5}

Example: Xy8Qz

Use when:

  • API responses (compact)
  • Database storage (efficient)
  • Network transmission (bandwidth-limited)
  • User-facing references (easy to communicate)
  • Mobile/IoT (constrained devices)

Benefits:

  • Compact (5 chars vs ~15-30 chars)
  • Easy to communicate (users can say "error Xy8Qz")
  • Efficient storage
  • URL-safe

Using Both Together

Logs:

[2024-01-15 10:30:00] ERROR E.Auth.Token.001 [Xy8Qz]: Token missing
                            ^^^^^^^^^^^^^^^^  ^^^^^
                            Semantic meaning  Searchable hash

API Response:

Json
{
  "error": {
    "code": "E.Auth.Token.001",
    "compact_id": "Xy8Qz",
    "message": "Token missing from Authorization header",
    "timestamp": "2024-01-15T10:30:00Z"
  }
}

Monitoring Dashboard:

Filter by component: E.Auth.*
Group by primary: E.Auth.Token.*, E.Auth.Session.*
Search by hash: Xy8Qz

User Support:

User: "I got error Xy8Qz"
Support: [looks up Xy8Qz] โ†’ E.Auth.Token.001 (TOKEN_MISSING)
         "You need to provide an authentication token"

Usage Patterns#

Pattern 1: Simple Logging

[ERROR] E.Auth.Token.001: Authentication failed

Use structured code only. Human-readable, self-documenting.

Pattern 2: Compact API

Json
{"error": "Xy8Qz"}

Use compact ID only. Client looks up details in catalog.

Pattern 3: Full Context

[ERROR] E.Auth.Token.001 (Xy8Qz): Authentication failed

Use both. Semantic meaning + searchable hash.

Pattern 4: Structured Logging

Json
{
  "severity": "error",
  "code": "E.Auth.Token.001",
  "compact_id": "Xy8Qz",
  "component": "Auth",
  "primary": "Token",
  "sequence": 1,
  "message": "Token missing"
}

Full decomposition for structured logging systems.

Benefits of the 5-Part Design#

1. Dual Representation

Humans:   E.Auth.Token.001 (readable, semantic)
Machines: Xy8Qz (compact, efficient)

Best of both worlds!

2. Hierarchical Organization

Group by component:  E.Auth.*
Filter by primary:   E.Auth.Token.*
Search by sequence:  *.*.*.001 (all "missing" errors)
Find specific:       Xy8Qz

3. Cross-Language Compatibility

Rust:       E.Auth.Token.001 -> Xy8Qz
Python:     E.Auth.Token.001 -> Xy8Qz
TypeScript: E.Auth.Token.001 -> Xy8Qz

Same code, same hash, everywhere

4. Graceful Degradation

If catalog unavailable:
- Structured code: Still somewhat understandable
  "E.Auth.Token.001" โ†’ probably auth token error
  
- Compact ID only: Meaningless without lookup
  "Xy8Qz" โ†’ what does this mean?

Redundancy provides fallback!

5. Flexible Adoption

Simple systems:     Use structured code only
Advanced systems:   Use full 5-part structure
Network-limited:    Use compact ID + catalog
Legacy integration: Map to/from other systems

One protocol, multiple adoption paths

Internationalization (i18n)#

Canonical Form

All error codes have a canonical English form:

[E.Auth.Token.001] -> Xy8Qz

Localized Aliases

Display can be localized, but hash is universal:

English:  [E.Auth.Token.001] -> Xy8Qz
Arabic:   [ุฎ.ุงู„ู…ุตุงุฏู‚ุฉ.ุงู„ุฑู…ุฒ.001] -> Xy8Qz
Japanese: [E.่ช่จผ.ใƒˆใƒผใ‚ฏใƒณ.001] -> Xy8Qz
Chinese:  [E.่ฎค่ฏ.ไปค็‰Œ.001] -> Xy8Qz
Key Insight

Hash is computed from canonical English form, but all localized aliases map to the same hash!

Hash input:  E.AUTH.TOKEN.001 (canonical English, uppercase)
Hash output: Xy8Qz (same for all languages)

Users see localized display
Systems use universal hash

See: 8-I18N for complete internationalization specification

Common Questions#

Q: Do I need to use all 5 parts?

A: You can use structured code only OR compact ID only, depending on your needs. Both represent the same error.

Q: Can I add custom fields?

A: The 5-part structure is the protocol core. You can add custom metadata in your implementation, but the 5 parts ensure interoperability.

Q: What if I need more than 999 sequences?

A: This usually indicates your Component.Primary is too broad. Split it into more specific categories. Example: Parser.Syntax.*, Parser.Semantic.*, Parser.Lexical.*

Q: Are named sequences required?

A: No! Numeric sequences (001-999) are the canonical identity. Named sequences are optional aliases for documentation and code readability.

Q: Can components be logical, not just physical?

A: Yes! Components can be physical (Database), logical (Auth), services (UserService), or architectural layers (Api). Choose what fits your system.

Stability and Evolution#

For version 0.1.0-draft, the specification parts are classified by stability level:

Stable (Breaking changes unlikely)

These parts define the core protocol and are considered stable:

PartDocumentStabilityNotes
11-SEVERITYStableSeverity codes (E, W, C, I, H) are fixed
22-COMPONENTStableComponent field format is fixed
33-PRIMARYStablePrimary field format is fixed
44-SEQUENCEStableSequence format (001-999) is fixed
55-COMPACT-IDSStablexxHash64 + Base62 encoding is fixed

Provisional (May evolve with feedback)

These parts are well-designed but may evolve based on implementation experience:

PartDocumentStabilityNotes
77-NAMESPACESProvisionalNamespace hash format is stable; boundary semantics may refine
88-I18NProvisionalCore model stable; locale fallback rules may evolve
99-CATALOGSProvisionalCatalog concept stable; format details may evolve
9a9a-CATALOG-FORMATProvisionalJSON schema may add optional fields
9b9b-WIRE-PROTOCOLProvisionalWire format stable; content negotiation may be added
9c9c-IMPLEMENTATIONProvisionalExamples may expand; patterns are recommendations
1111-SECURITYProvisionalSecurity model stable; requirements may strengthen
1212-METADATAProvisionalSchema structure stable; optional fields may be added

Informative (Non-normative guidance)

These parts provide recommendations and may change freely:

PartDocumentStabilityNotes
66-SEQUENCE-CONVENTIONSInformativeConventions are suggestions only
1010-PRESENTATIONInformativeVisual guidelines are recommendations

Evolution Principles

  1. Backward Compatibility: Stable parts will not introduce breaking changes without a major version bump
  2. Catalog Versioning: The version field in catalogs enables graceful migration
  3. Optional Extension: New features will be added as optional fields where possible
  4. Deprecation Policy: Features will be deprecated before removal, with at least one minor version warning

Specification Documents#

For detailed implementation specifications, see:

Core Specification (Parts 1-5)

Extensions & Conventions

Quick Reference#

WDP Error Code Structure
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  WDP Error Code Structure                                      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                โ”‚
โ”‚  [SEVERITY.COMPONENT.PRIMARY.SEQUENCE] -> COMPACT_ID           โ”‚
โ”‚   โ”‚        โ”‚         โ”‚        โ”‚            โ”‚                   โ”‚
โ”‚   โ”‚        โ”‚         โ”‚        โ”‚            โ””โ”€ Part 5: Hash     โ”‚
โ”‚   โ”‚        โ”‚         โ”‚        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Part 4: Event    โ”‚
โ”‚   โ”‚        โ”‚         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Part 3: Domain   โ”‚
โ”‚   โ”‚        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Part 2: Module   โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Part 1: Urgency  โ”‚
โ”‚                                                                โ”‚
โ”‚  Example: [E.Auth.Token.001] -> Xy8Qz                          โ”‚
โ”‚                                                                โ”‚
โ”‚  Parts 1-4: Human-readable structured code                     โ”‚
โ”‚  Part 5:    Machine-friendly compact identifier                โ”‚
โ”‚                                                                โ”‚
โ”‚  Hash is ALWAYS generated from structured code                 โ”‚
โ”‚  Both representations can be used independently                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Copyright ยฉ 2025 Ashutosh Mahala
Licensed under CC BY 4.0