VSO · Public research resources

VCP SDK troubleshooting: diagnosis and recovery

Diagnose indeterminate results, malformed input, nanosecond precision, policy mismatches and interrupted sealing while preserving original evidence and protecting private keys.

Start by preserving the failed input and identifying the revision

When verification fails or vcp seal refuses a batch, keep the original event bytes, AnchorRecord, command, exit code and complete report together. Diagnose a copy in a new output location. Do not edit a signed timestamp, replace a hash, remove a failed record or regenerate a signature merely to obtain VALID. Missing evidence cannot be manufactured by a repair command.

Record the full SDK source commit or installation provenance, runtime and operating system. vcp --version returning 0.1.0 is insufficient: the unchanged prerelease tag is cc6c4689c312662dcd9157f3270e6ed8f2c509cb, while later source retains the same package version. This guide reads main at 1e75820e954eda7232bc57eb21037efaa1cbf1ba. Its README separately prescribes installation snapshot 59860c5d3180ac8bdc2e8b9df500af7ae2c162f7. Do not assume a fixed tag, an installed snapshot and later main contain the same fixes.

Check VCP SDK: pinned installation, CLI results and operating limits and VCP SDK: unreleased fixes versus the unchanged prerelease tag before changing an environment. The older 0832f1d8 installation snapshot predates batch-policy and output-pair corrections; 28d46e84 drops the optional PolicyIdentification block when sealing. Evaluate a newer snapshot separately and retain the original failed run.

Capture the report before deciding what to retry

In this POSIX-shell example (Bash) for an installed Python CLI, replace the paths below with preserved inputs and a public key obtained through your trust process. The command writes diagnostics into a fresh private temporary directory. It does not need the signer's private key.

diagnosis_dir="$(mktemp -d "${TMPDIR:-/tmp}/vcp-diagnosis.XXXXXX")" &&
{
  if vcp verify-batch "/path/to/events.jsonl" \
      --anchor "/path/to/anchor.json" \
      --public-key "/path/to/trusted-public-key.txt" \
      > "$diagnosis_dir/report.json" \
      2> "$diagnosis_dir/stderr.txt"; then
    sdk_exit=0
  else
    sdk_exit=$?
  fi
  printf '%s\n' "$sdk_exit" > "$diagnosis_dir/exit-code.txt"
}
Exit codes verified in this CLI revision
CodeMeaningNext action
0VALID for a verification report; success for commands such as seal.Read the checks and notes. Successful signing is not verification of an external anchor.
1INVALID: a performed check found a mismatch or malformed field.Preserve the failed evidence and inspect the named check, subject and reason.
2INDETERMINATE: a required check could not establish a result.Identify missing evidence, trust or supported capability. This is not a pass.
3Handled usage/input errors, unreadable or malformed input, a seal refusal, or an exception reaching the CLI handler.Read stderr; a verifier report may not have been produced. Diagnose the input or operation failure separately from a verdict.

Aggregation is INVALID > INDETERMINATE > VALID. An unexpected error inside a guarded verifier adds VERIFIER_ERROR as an indeterminate check; previously detected invalid checks remain. That report exits 2, or 1 if another check is invalid. A killed process or interrupted machine may leave no completed report; do not infer a verdict from an absent output. Sources: Python CLI: exit codes, signing checks and output-path preflight and Python verifier: individual checks, aggregation and missing evidence.

Separate unavailable evidence from a demonstrated mismatch

Common report reasons and bounded responses
Reason or checkWhat to inspectAppropriate response
MISSING_ANCHOR_RECORDWas the matching AnchorRecord supplied?Obtain the retained record from its custodian. Do not construct a replacement and present it as the original.
MISSING_ANCHOR_PROOFIs AnchorTarget missing, or its Proof empty?Request the actual proof associated with the claimed anchor. Retain the indeterminate finding while it is unavailable.
EXTERNAL_ANCHOR_NOT_VERIFIEDA proof is present, but no external verifier was supplied.The offline CLI exposes no external-anchor-verifier option. An application integration must provide an appropriate external_anchor_verifier; adding a proof string alone is insufficient.
KEY_NOT_ESTABLISHEDThe trusted key is missing, unusable or rejected.Establish the key and its binding through an external trust process. A key copied from the submitted evidence is not automatically trusted.
HASH_MISMATCH / SIGNATURE_MISMATCHOriginal bytes, parsing path, selected key and signed-data contract.Check the precision path below, then investigate the mismatch. Preserve the original failure; do not recompute stored evidence to conceal it.
LEGACY_MERKLE_CONSTRUCTIONWas the root built with the specification's odd-node-duplication example?Record the construction difference. The SDK treats that known ambiguity as indeterminate; changing a stored root is not a repair of the historical evidence.

The SDK does not contact anchor services. A supplied anchor verifier returning no determinate result, or raising, leaves ANCHOR_PENDING_OR_UNREACHABLE. Investigate that adapter and retain its diagnostics; do not substitute a callback that always returns true. A new anchor obtained today does not establish that the records were anchored at an earlier claimed time.

An event-level VALID can coexist with batch-level INDETERMINATE. A root signature also does not authenticate all AnchorRecord metadata: counts, endpoint IDs and policy are compared with the supplied events, and the timestamp check covers format only. Sources: Python verifier: individual checks, aggregation and missing evidence and SDK implementation interpretations and verification boundaries.

Diagnose nanosecond rounding and rejected JSON at the input boundary

In TypeScript, re-read the original JSON text with parseJson for one document or parseJsonLines for JSON Lines. The SDK parser retains integer literals outside the safe-number range as bigint. The following is an integration pattern, not an executed test result:

import { parseJson, parseJsonLines } from "@veritaschain/vcp";

const event = parseJson(originalEventText);
const events = parseJsonLines(originalEventLines);

Ordinary JSON.parse can turn 1791504000123456789 into 1791504000123456768. Converting the already rounded number to BigInt cannot recover the missing digits. If the original text is unavailable, request it and retain that limitation. Do not guess the timestamp or change the signed integer to a string. Use the SDK's toJson when exporting SDK values that contain bigint, while retaining the received original file separately.

The SDK's exact-integer canonicalization is an implementation interpretation, not literal binary64 treatment of every number. CANONICALIZATION_UNSUPPORTED may reflect a numeric representation it refuses; changing strictIntegers just to match a hash changes the comparison rules. Record and compare the producer's and verifier's declared rules instead.

The CLI also rejects malformed UTF-8/JSON, duplicate keys, a byte-order mark and non-JSON constants, with additional depth and numeric limits. JSON Lines split on newline \n, not arbitrary Unicode separators. Preserve rejected bytes; request a corrected export as a separately identified input rather than silently normalizing the original. Sources: TypeScript strict JSON parser and exact large integers, Python strict JSON and JSON Lines input handling and SDK implementation interpretations and verification boundaries.

Resolve PolicyID and chain refusals without rewriting evidence

For seal, the complete input must have one Header.PolicyID; an explicit --policy-id must match it. The CLI checks that policy before invoking the signing key. If present, top-level PolicyIdentification must be an object with a matching PolicyID. The reviewed code retains that complete object as unsigned metadata; its conformance tier or registration details are not covered by the event signature.

If the source legitimately mixes policies, prepare separately identified, policy-homogeneous unsigned inputs while preserving the original order and reviewing chain boundaries. Do not relabel a signed Header or reorder events to force a common policy. During verification, POLICY_MISMATCH concerns the event's policy block, while anchor_binding / BINDING_MISMATCH can include an AnchorRecord policy, count or endpoint-ID mismatch. Obtain the correct matching evidence, not a guessed replacement value.

A producer-written EventHash mismatch or a broken PrevHash causes seal to refuse publication. For a file continuing a chain, use the retained previous file's last_event_hash as --prior-hash and verify the first link. Do not invent a prior hash or delete the link. --allow-missing-hash deliberately relaxes the requirement for a producer-written hash; it is not a recovery step for a failed hash comparison. Preserve the refusal and resolve its cause before another attempt. Source: Python CLI: exit codes, signing checks and output-path preflight.

Check output aliases, permissions and competing writers

  1. Keep --out and --anchor-out distinct from one another, the event input and the private-key file. The CLI resolves relative paths and symbolic links, and checks existing hard-link aliases. A detected collision returns 3 before either output is written.
  2. Choose a new output location for diagnosis. Existing distinct output files are replaced on a successful seal; they are not automatically a retained history.
  3. Check that both destination directories exist and permit the operation, and that existing targets are writable regular files. Do not broaden access permissions on sensitive directories merely to suppress an error.
  4. If stderr says a seal staging directory is already in use, identify the active writer or unresolved prior attempt. Cooperating seal processes sharing a destination are excluded by the staging directory; unrelated writers are not controlled by that mechanism. Stop or coordinate writers before recovery.

The path preflight is not a general filesystem lock. Protect input and output directories from other writers: seal signs the valid records supplied to it, not an independently established account of what occurred. Sources: Python CLI: exit codes, signing checks and output-path preflight and Seal output publication: staging, replacement, rollback and cleanup.

Recover a staged output pair after failure or a crash

Seal prepares both files in their destination directories, then replaces the events file and the anchor file in sequence. This is not an atomic replacement of the pair. Consumers should read both only after a successful exit. The following procedure addresses this implementation's publication files, not a guarantee of crash durability.

  1. Stop writers and pause consumers. Preserve the input, existing output pair, stderr and remaining .vcp-seal-* directories. Record their paths and hashes locally before recovery.
  2. Identify the failure phase. An ordinary anchor-replacement error triggers restoration of the previous events file, or removal of a newly created events file. If rollback also fails, the error identifies recovery directories and leaves staged files, including any previous backup. An abrupt process or machine stop can interrupt this sequence.
  3. Inspect both outputs together. Establish whether they are the retained prior pair, the complete new pair, or a mixture. Use the preserved input, expected batch membership, hashes and local verification checks. Overall INDETERMINATE from unavailable external anchoring is still possible; it does not excuse a local hash, signature or binding mismatch.
  4. Restore or verify a coherent pair. Retain the interrupted state as evidence. Use the identified backups and provenance, not guessed values. If a matching pair cannot be established, keep it unresolved and obtain missing material from its custodian.
  5. Clean up only after inspection. Once no writer owns the affected staging directories and recovery is complete, remove only the identified leftovers before an intentional new attempt. Do not blindly delete every .vcp-seal-* directory or retry until the error disappears.

A cleanup warning can occur after successful publication without changing exit 0. Check that output pair, then handle the specifically named leftover directory; do not assume the warning means signing failed. Sources: VCP SDK: pinned installation, CLI results and operating limits and Seal output publication: staging, replacement, rollback and cleanup.

Prepare a diagnostic handoff without disclosing secrets

Keep a local diagnostic bundle with the source commit, installation provenance, runtime/OS, exact command with secret values omitted, stdout/stderr, individual check names and reasons, input/output hashes, relevant trust assumptions and whether a recovery step changed the working copy. Preserve each attempt under a distinct identity.

Private keys are read from a file or VCP_PRIVATE_KEY, not a literal command-line option. On POSIX, the CLI rejects a key file granting group/other permissions; use restricted ownership and mode 0600. Windows ACLs are not checked by this CLI. Environment variables are inherited by child processes. Verification does not require a private key: never include the seed, raw credentials or secret-bearing input in a public support report. Share a separately prepared redacted or synthetic reproduction and keep the untouched evidence under appropriate access controls.

VALID means the performed checks matched; it does not establish producer conformance, certification, correct decisions or complete recording. VAP/VCP repairs and experimental extensions remain unadopted, and independent third-party reproduction has not been established. First-party CI and saved-evidence rechecks are distinct from an independently executed reproduction. This guide reports a source review, not a new SDK or research test run.

Continue to SDK installation and scope, version and distribution status, VCP integrity interpretations or Explorer result interpretation for the corresponding next task.

Sources and reviewed revisions

This page summarizes public materials at pinned commits. Creating it is not a new research test run. Historical test records and fixed distributions remain unchanged.