Validation Error & Warning Codes¶
This reference documents all validation codes returned by okf-schema’s validation commands (validate and validate-md).
Error Codes (E0–E11)¶
Errors represent conformance violations that must be fixed before the validation passes.
E0: Invalid Bundle Path¶
Severity: Error
Description: The path passed to bundle validation is not a directory.
How to Fix: Pass the bundle directory itself, such as
okf-schema validate --path my-bundle/bundle.
E1: Missing or Unparseable Frontmatter¶
Severity: Error
Description: A markdown file lacks YAML frontmatter (the --- delimiter at the start) or contains unparseable YAML.
Example:
# My Document
This file has no frontmatter.
How to Fix: Add proper YAML frontmatter at the beginning of the file:
---
type: concept
title: My Document
description: A brief description
---
# My Document
Document content here.
E2: Missing or Empty type Field¶
Severity: Error
Description: The frontmatter is valid YAML, but the type field is missing, null, or empty.
Example:
---
title: My Concept
description: A concept without a type
---
How to Fix:
Add a non-empty type field to the frontmatter:
---
type: concept
title: My Concept
description: A concept without a type
---
E3: Reserved File with Unexpected Frontmatter¶
Severity: Error
Description: A reserved file (index.md or log.md) has frontmatter when it should not.
Rule:
log.mdmust NEVER have frontmatter (applies only to OKF bundle validation)Non-root
index.mdfiles must NOT have frontmatterOnly the bundle-root
index.mdmay optionally have frontmatter (withokf_versionfield)
How to Fix:
For log.md: Remove the frontmatter block and keep only dated headings.
For non-root index.md: Remove the --- delimiters and frontmatter, keeping only the body content.
E4: Schema Validation Failed¶
Severity: Error
Description: The frontmatter failed validation against the corresponding JSON Schema.
Example:
[type] 'unknown_type' is not one of the allowed values: ['concept', 'principle', 'reference']
[required_field] 'title' is a required property
How to Fix: Examine the schema error message and adjust the frontmatter to match the schema requirements. Common issues:
Missing required fields (check your schema for
requiredlist)Invalid enum values (must match allowed values exactly)
Wrong data types (e.g., string when number expected)
E5: Nested List Structures in Frontmatter¶
Severity: Error
Description: The frontmatter contains nested list structures, which indicate flatten-able content. This is considered an error because coding agents typically load only the first N lines of a file, and nested structures expand the frontmatter unnecessarily.
Example:
---
type: concept
tags: [[common, important], [ai, llm]] # Nested lists
---
How to Fix: Flatten nested lists into a single level:
---
type: concept
tags: [common, important, ai, llm]
---
E6: Reserved File Not at Bundle Root¶
Severity: Error (OKF bundle validation only)
Description: A reserved file is located in an unexpected directory. Specifically, log.md must be at the bundle root.
How to Fix:
Move the file to the correct location. For log.md, it must be at the root of your OKF bundle.
E7: generated Block Missing at Field¶
Severity: Error (OKF 0.2)
Description: A frontmatter generated block is present but the required at field is missing.
Example:
---
type: concept
generated:
by: "human:alice" # missing `at`
---
How to Fix:
Add the required at field:
---
type: concept
generated:
at: "2026-08-10T14:00:00Z"
by: "human:alice"
---
Fix: okf-schema lint --path <bundle>
E8: sources Entry Missing resource Field¶
Severity: Error (OKF 0.2)
Description: A sources list entry is missing the required resource field.
Example:
sources:
- id: paper-1
title: "My Paper" # missing `resource`
How to Fix:
Add the required resource field:
sources:
- id: paper-1
resource: "https://example.com/paper.pdf"
title: "My Paper"
Fix: add resource: <URI-or-path> to the sources entry.
E9: verified Entry Missing by or at Field¶
Severity: Error (OKF 0.2)
Description: A verified list entry is missing the required by or at field.
Example:
verified:
- method: "peer-review" # missing `by` and `at`
How to Fix: Add the required fields:
verified:
- by: "human:alice"
at: "2026-08-10"
method: "peer-review"
Fix: add by: <actor> and at: <ISO-8601-date> to the verified entry.
E10: File-Link Target Invalid¶
Severity: Error (only when --check-links is enabled)
Description: An x-okf-link annotation is malformed, an exact target is
missing, a bundle/project-relative target escapes its root, or a filename stem
does not exist or matches more than one Markdown file. The annotation is otherwise ignored by
ordinary JSON Schema validation.
How to Fix:
Use one of the documented
resolutionandsyntaxvalues.Correct the exact path, or create the target file.
Use a bundle/project-relative path that stays inside its root.
Rename duplicate Markdown basenames or use a different relationship value.
Enable the check with okf-schema validate --check-links or
okfreq validate --check-links. A link-projection key in the annotation must be
a non-empty string on a filename-stem, bundle-relative or
bundle-relative-stem resolution.
E11: Malformed Projection Annotation¶
Severity: Error (okf-schema validate; okfreq validate reports the same
problems as errors)
Description: A schema declares a projection that okf-schema lint cannot
apply: a link-projection label that is empty, not a string, or set on a
resolution that leaves the bundle (document-relative, project-relative); or
an x-okf-status-projection that is not a mapping, maps a value to something
other than draft, stable or deprecated, or misses a value of the property
enum.
Schema 'note': parents: x-okf-link link-projection needs a resolution inside the bundle (bundle-relative, bundle-relative-stem, filename-stem), not project-relative
Schema 'note': state: x-okf-status-projection has no OKF status for gone
How to Fix: Remove the label from fields that point outside the bundle, and map every lifecycle value to an OKF status.
Warning Codes (W0–W18)¶
Warnings indicate best-practice violations or missing metadata. Validation passes with warnings unless --strict mode is enabled.
W0: Standalone Path Is Not a File¶
Severity: Warning (validate-md only)
Description: A resolved standalone input path is not a regular markdown file. Correct or narrow the input pattern.
W1: Missing Recommended Fields¶
Severity: Warning
Description: Recommended frontmatter fields (title or description) are missing or empty.
Why It Matters:
title: Provides a human-readable name for the conceptdescription: Summarizes the concept’s purpose in 1–2 sentences
These fields are important for browsing and searching knowledge bases.
How to Fix: Add the missing fields:
---
type: concept
title: My Important Concept
description: A brief, one-sentence summary of what this concept is about
---
W2: Broken Cross-Link¶
Severity: Warning (OKF bundle validation only)
Description: A markdown link in the file body points to a file that does not exist.
Example:
See also [related concept](../concepts/related.md) for more details.
If related.md does not exist, this triggers a W2 warning.
How to Fix: Either:
Create the referenced file, or
Update the link to point to a file that exists, or
Remove the broken link
W3: Missing Provenance Timestamp¶
Severity: Warning
Description: The frontmatter lacks generated.at, which records document
provenance. A legacy timestamp suppresses W3 but separately triggers W8.
How to Fix:
Add generated.at in ISO 8601 format:
---
type: concept
title: My Concept
generated:
at: "2024-07-06T00:00:00Z"
---
W4: Missing index.md in Directory¶
Severity: Warning (OKF bundle validation only)
Description: A directory contains markdown files but no index.md file. The index.md serves as a directory listing and introduction.
How to Fix:
Create an index.md file in the directory:
---
okf_version: "0.1"
---
# Category Name
Overview of this category...
## Contents
- [Concept A](./concept-a.md)
- [Concept B](./concept-b.md)
W5: Non-ISO 8601 Date in log.md¶
Severity: Warning (OKF bundle validation only)
Description: A log.md file has a level-2 heading that is not exactly a
valid ISO 8601 date (YYYY-MM-DD), for example a date followed by a topic.
Example:
## July 6, 2024 # Wrong format
## 2024-07-06 (import) # Wrong: topic in the heading
- Added new concept
How to Fix:
Use ISO 8601 format for all log.md headings and put a topic in a sub-heading:
## 2024-07-06
### Import
- Added new concept
okf-schema lint --check and okfreq lint --check fail on W5.
W6: No Schema Found for Type¶
Severity: Warning
Description: A file’s type field does not match any schema in the schema directory, so schema validation cannot proceed.
Why This Happens:
You declared
type: my_custom_typebut there is nomy_custom_type.schema.jsonfileThe schema file exists but has a different name
How to Fix:
Option 1: Create a schema file matching your type:
schemas/
my_custom_type.schema.json # Create this file
Option 2: Change the type to match an existing schema:
---
type: concept # Use an existing schema
---
W7: Block-Style Lists in Frontmatter¶
Severity: Warning
Description: The frontmatter uses block-style (multi-line) lists instead of inline notation. While valid, this expands the frontmatter vertically, reducing the amount of content visible to coding agents that load only the first N lines of a file.
Example:
---
type: concept
tags: # Block-style list
- important
- ai
- llm
---
How to Fix: Convert to inline notation:
---
type: concept
tags: [important, ai, llm] # Inline list is more compact
---
To automatically fix all W7 warnings in an OKF bundle, run:
okf-schema lint --path <bundle>
Note (OKF 0.2): The
sources,verified, andparameterslist-of-mapping fields are exempted from inline-forcing byokf-schema lint. Their block style is preserved for readability.
W8: Deprecated timestamp Field¶
Severity: Warning (OKF 0.2 migration)
Description: The frontmatter uses the deprecated OKF 0.1 timestamp field instead
of the OKF 0.2 generated.at field.
Example:
timestamp: "2026-08-10T14:00:00Z" # deprecated
How to Fix:
Replace timestamp with a generated block:
generated:
at: "2026-08-10T14:00:00Z"
by: "human:alice"
Fix: okf-schema lint --path <bundle>. Lint preserves the legacy value as
generated.at; it does not invent a generated.by actor.
Stable code: W8
W9: Deprecated Body # Citations Section¶
Severity: Warning (OKF 0.2 migration)
Description: The document body contains a # Citations heading. In OKF 0.2,
citations move to the sources frontmatter field with markdown footnotes.
How to Fix:
Add a
sources:frontmatter list with entries havingresourceand optionalid.Reference sources in the body using footnote syntax
[^id].Remove the body
# Citationssection.
sources:
- id: ref-1
resource: "https://example.com/paper.pdf"
title: "Example Paper"
This claim is supported by the literature.[^ref-1]
Fix: Manually migrate citations to sources: frontmatter and [^id] footnotes.
Stable code: W9
W10: Malformed Actor String in verified[].by¶
Severity: Warning (OKF 0.2)
Description: A verified entry has a by value that does not conform to the
OKF actor string format <prefix>:<identifier>. Only well-formed human: actors
promote the trust tier; malformed actors are ignored for tier derivation.
Example:
verified:
- by: "Alice" # malformed — should be "human:alice"
at: "2026-08-10"
How to Fix:
Use the <prefix>:<identifier> format:
verified:
- by: "human:alice"
at: "2026-08-10"
Stable code: W10
W11: Stale File¶
Severity: Warning (OKF 0.2)
Description: The stale_after date or instant has been reached, meaning the
document may contain outdated information. OKF 0.2 defines stale_after as an
ISO 8601 datetime with an explicit UTC offset (Z or ±HH:MM), compared as an
instant against the current time in UTC. A bare YYYY-MM-DD date is still
accepted and is stale from the start of that day. Unquoted YAML timestamps are
handled the same way as quoted strings. A value that cannot be interpreted is
reported as W16 instead.
Example:
stale_after: 2025-01-01T00:00:00Z # past instant → W11
stale_after: "2025-01-01" # past date (legacy form) → W11
How to Fix:
Either update the content and set a new stale_after value, or remove the field:
stale_after: 2027-01-01T00:00:00Z # updated future instant
Stable code: W11
W12: Unmatched Footnote Reference¶
Severity: Warning (OKF 0.2)
Description: A body footnote reference [^id] has no corresponding entry in the
sources frontmatter list with a matching id.
Example:
See the paper.[^ref-1]
Without a sources entry having id: ref-1.
How to Fix:
Add the corresponding sources entry:
sources:
- id: ref-1
resource: "https://example.com/paper.pdf"
Stable code: W12
W13: Broken Path in resource Field¶
Severity: Warning (OKF 0.2)
Description: A sources[].resource value contains a path-form string that
does not resolve to an existing file. URL and scope-descriptor forms are skipped.
Example:
sources:
- resource: "docs/missing-file.pdf" # file does not exist
How to Fix: Correct the path or use a full URL:
sources:
- resource: "https://example.com/paper.pdf"
Stable code: W13
W14: Stale or Invalid OKFKB Derivation Graph¶
Severity: Warning (OKFKB bundle validation only)
Description: An authored derived_from entry is not an existing canonical
bundle-relative, extensionless document path, or the CLI-computed derives_to
reflection is missing or stale. Validation reports this condition without
modifying files.
How to Fix:
Correct invalid authored paths, then recompute managed graph fields:
okfkb update <bundle>
Do not edit fields below this frontmatter separator manually:
# knowledge graph fields generated automatically — do not edit manually
derives_to: []
Stable code: W14
W15: File-Link Check Skipped¶
Severity: Warning (only when --check-links is enabled)
Description: A file-link check could not be resolved because the required bundle/project root is unavailable or filesystem access prevents inspection of the target or matching candidate. The CLI reports the affected field and the reason. A missing stem in an available bundle is an E10 error.
How to Fix:
Supply
--bundle-rootfor generic standalonevalidate-mdchecks when bundle-relative or filename-stem links are intentional.Supply
--project-rootfor project-relative links.Ensure the intended Markdown target exists in the bundle.
W15 is advisory and does not fail validation unless strict mode is enabled. It is never emitted when file-link checking is disabled.
W16: Unparseable stale_after¶
Severity: Warning (OKF 0.2)
Description: stale_after is present but is not a bare ISO date or an ISO 8601
datetime with an explicit UTC offset, so the staleness check (W11) cannot run and
the concept would otherwise be treated as fresh without any signal. Typical causes
are a typo (tomorrow), a datetime without an offset such as
2026-12-31T00:00:00 (it names a different instant in every timezone, so it is not
guessed), or a non-string value such as a number. An empty or null stale_after is
treated as absent and does not trigger W16.
Example:
stale_after: 2026-12-31T00:00:00 # no UTC offset → W16
stale_after: tomorrow # not a date → W16
How to Fix: Write the value as an ISO 8601 datetime with an offset, or remove the field:
stale_after: 2026-12-31T00:00:00Z
Stable code: W16
W17: Schema File Cannot Be Parsed¶
Severity: Warning
Description: A schema file in the schema directory (_schema/ or the
directory given with --schema-db / --schemas-dir) cannot be used. The file
has a syntax error (JSON, JSON5 or YAML), cannot be read, or its top-level value
is not a mapping (for example a list or a number). The type named by the file
stays without schema, so its documents are not checked against it and
receive W6. The message always carries the file name and the reason:
schema file 'note.schema.json' cannot be parsed: Expecting property name enclosed in double quotes: line 2 column 1 (char 19)
schema file 'task.schema.yaml' cannot be parsed: top-level value must be a mapping, got list
The finding’s path is the schema file. The rule is identical for
.schema.json, .schema.json5, .schema.yaml and .schema.yml.
How to Fix: Correct the syntax, or make the file a mapping that holds a JSON
Schema (type: object, properties, …).
W17 fails validation only in --strict mode. okfreq validate, status and
report list it but never count it as an error.
W18: log.md Dates Repeated or Out of Order¶
Severity: Warning (OKF bundle validation only)
Description: OKF section 9 lists log entries newest first. A date heading repeats an earlier date or is newer than the heading above it.
How to Fix: Keep one ## YYYY-MM-DD heading per date, newest first, and
append new entries to the existing section of their date.
okf-schema lint --check and okfreq lint --check fail on W18.
Informational Codes (I1)¶
Informational findings explain a situation without asking for a fix. They are
shown as INFO, are never counted as warnings or errors, and never fail
validation, not even with --strict.
I1: Schema File Is Empty¶
Severity: Informational
Description: A schema file exists but holds no schema: the file is empty,
contains only whitespace, or (JSON5, YAML) contains only comments. Plain JSON has
no comments, so a JSON file with only a comment is a syntax error (W17). This is the state of
a schema file that was just created and not filled yet. The type stays without
schema, so its documents receive W6, and the file name is reported:
schema file 'task.schema.yaml' is empty
The finding’s path is the schema file. The rule is identical for
.schema.json, .schema.json5, .schema.yaml and .schema.yml.
How to Fix: Write the schema, or delete the file if the type should not have one.
Contract for editors and other consumers¶
Tools built on okf-schema should show the same outcomes for the same file:
File content |
Code |
Message |
Type has schema |
|---|---|---|---|
Empty or whitespace-only (any format), or comments only (JSON5, YAML) |
|
|
No |
Syntax error or unreadable file |
|
|
No |
Valid syntax but top-level value is not a mapping |
|
|
No |
A mapping |
none |
none |
Yes |
<name> is the file name without its directory. From Python,
okf_schema.validator.load_schema_database_with_diagnostics returns the same
findings as Finding records with code, message and path.
Exit Codes¶
Exit Code |
Meaning |
|---|---|
0 |
Validation passed (no errors; warnings allowed unless |
1 |
Validation failed (errors found, or warnings in |
Using --strict Mode¶
By default, validation passes as long as there are no errors (warnings are allowed):
okf-schema validate --path my-bundle # Exit 0 (2 warnings, 0 errors)
With --strict mode, even warnings cause validation to fail:
okf-schema validate --path my-bundle --strict # Exit 1 (2 warnings, 0 errors)
Use --strict in CI/CD pipelines to enforce best practices.
Validation Scope¶
Bundle Validation (validate)¶
When validating an OKF bundle, the following checks are applied:
All Markdown files: E1, E2, E4, E5, E7-E10, W1, W2, W3, W6-W16 Schema directory: W17, I1 (reported for every schema file that yields no schema) Reserved files: E3, E6 Bundle structure: W4
Non-Markdown files are not concept documents and are ignored by document validation. They may be stored in the bundle and referenced as attachments from Markdown concepts.
Standalone Validation (validate-md)¶
When validating standalone markdown files without a bundle, the following checks are applied:
All files: E1, E2, E4, E5, E7-E10, W1, W3, W6-W13, W15, W16
Schema directory (--schemas-dir): W17, I1
Not applied (bundle-specific):
W2 (broken links require a common root for resolution)
W4 (directory structure validation)
W14 (OKFKB derivation graphs require a bundle and local schema)
E3, E6 (bundle structure rules)
Examples¶
Example 1: Fix E1 + E2¶
Original:
# My Concept
Description of the concept.
Problem: No frontmatter (E1)
Fixed:
---
type: concept
title: My Concept
description: Description of the concept
---
# My Concept
Description of the concept.
Example 2: Fix E4 (Schema Error)¶
Schema (concept.schema.json):
{
"type": "object",
"properties": {
"type": { "enum": ["concept"] },
"title": { "type": "string" },
"category": { "enum": ["AI", "Engineering", "Other"] }
},
"required": ["type", "title", "category"]
}
File with E4 error:
---
type: concept
title: My Concept
category: Biology # Not in allowed enum
---
Fixed:
---
type: concept
title: My Concept
category: AI # Must match allowed values
---
Example 3: Fix W1 + W3¶
Original:
---
type: principle
---
Problems: Missing title (W1), missing description (W1), and missing
generated.at (W3)
Fixed:
---
type: principle
title: Keep Frontmatter Compact
description: Coding agents load the first N lines; block-style lists reduce visible content
generated:
at: "2024-07-06T00:00:00Z"
---