Skip to content
STIRUP

TECHNOLOGY INTELLIGENCE

Understand what's next.

AI Agents Fabricate Nigerian Postcodes Without Verification

AI agents can generate incorrect Nigerian postcodes by relying on internal knowledge instead of verified sources like NIPOST, leading to fabricated six-digit patterns.

Share
AI-generated conceptual illustration accompanying: AI Agents Fabricate Nigerian Postcodes Without Verification
AI-generated editorial illustration of the article topic; not a photograph, product screenshot or measured result.

Understanding the Problem: AI Agents and Nigerian Postcodes

AI agents can sometimes generate incorrect or fabricated information, such as inventing non-existent Nigerian postcodes. This issue arises when agents rely on internal knowledge rather than verified sources. In one instance, an AI agent produced a six-digit postcode pattern without searching the web, despite having access to a search tool and current date information [FreeCodeCamp]. This highlights the need for developers to implement checks that ensure AI outputs are grounded in reliable data. Techniques such as enforcing search requirements, validating outputs against official sources like NIPOST, and setting clear boundaries for AI behavior can help mitigate this problem. These steps ensure that AI agents do not fabricate information and instead provide accurate, contextually appropriate responses.

Correcting the AI Agent with Specific Rules

Correcting an AI agent's misunderstanding of Nigerian postcodes requires providing it with precise, up-to-date information. In one instance, an AI agent generated a six-digit postcode pattern, which failed to match real Nigerian postcodes like EK-01-A03-FK-01. This occurred because the agent lacked knowledge of the 11-character digital postcode format (NDAPS) introduced by NIPOST on 1 October 2026. To address this, users can add specific rules to their project's configuration files, such as AGENTS.md or CLAUDE.md, clarifying that Nigerian postcodes now follow the NDAPS format and that six-digit patterns are invalid. This rule was tested on 13 October 2026, and the agent correctly recognized the new format when the rule was applied. For further details, see the reference at https://adeniyikayodee.github.io/ng-postcode/llms.txt.

Implementing Tools with Enforced Limits

Implementing tools with enforced limits can help prevent AI agents from generating invalid or fabricated data, such as non-existent Nigerian postcodes. By integrating validation mechanisms, developers can ensure that AI-generated outputs conform to real-world standards. For example, the ng_postcode library provides functions like parse() and lookup() that verify whether a given postcode exists. In one test, the code EK-01-A03-FK-01 was checked against a real database, and it was confirmed to be invalid, returning False as expected. This approach ensures that AI agents do not invent postcodes, as the system enforces strict validation rules. Developers should use such tools to maintain data integrity and avoid misinformation.

Routing and Validation of Postcodes

Routing and validation of postcodes in AI systems requires careful design to prevent errors like the invention of non-existent Nigerian postcodes. Developers can use libraries such as ng_postcode to parse and validate postcodes, ensuring that only legitimate codes are processed. A routing table, such as DEPOTS, can be implemented as a data structure that maps valid postcode segments to specific depots or sorting actions. This table is under the control of the developer and can be reviewed for accuracy. When an AI agent processes a postcode, it should only call external services like NIPOST after confirming the input has been parsed correctly. Additionally, when an agent must interact with postcodes directly, it should be provided with well-documented tools, similar to how one would document a microservice, to ensure transparency and accountability in its operations.

Managing Paid Tools and Limitations

Managing paid tools in AI agents requires careful configuration to avoid unintended behavior, such as an AI agent attempting to generate or use Nigerian postcodes incorrectly. According to FreeCodeCamp, the server enforces three limits, and the five default tools are read-only. A sixth tool, lookup_postcode_details, is available only when the NG_POSTCODE_MAX_LEVEL is raised to 2 or more, as noted in FreeCodeCamp. On a default server, the model cannot request this tool, and any attempt to use it results in an error, as described in FreeCodeCamp. When the cap is raised, the paid tool becomes accessible without the read-only restriction, but clients that approve read-only tools will still prompt the user before spending credits. This setup ensures control over tool usage and prevents unauthorized or unintended actions by AI agents.

Sources and reporting notes

Based on published source material. No independent hands-on testing is claimed.

Read more