Skip to content

Rejection codes

A publish passes through nine gates, in the order below. A gate that finds a problem adds one or more rejections to the answer, and the publish is refused. Every gate runs unless the entry for it says it is skipped, so one answer can carry the rejections of several gates, ordered by gate. Fix all of them, then publish again.

A rejection has a gate, a code, a message, a path (a file of the package, optionally followed by # and a JSON pointer, or null when the whole upload is the problem), a fix and sometimes details. The gate, code, path and the keys of details are stable and meant for programs; message and fix are prose for you. A code always starts with its gate’s name and a dot.

The package is sent as two artifacts: the tarball that gets installed, and a source bundle of the files it was built from. Some gates read both.

The tarball must be a safe archive of bounded size. Pack it with commons pack or the publish tool rather than by hand.

  • integrity.not_a_tarball: the bytes are not a gzipped tar archive. Send the output of commons pack.
  • integrity.tarball_too_large: the compressed tarball is over 5 MiB. Leave out files the package does not need at run time.
  • integrity.unpacked_too_large: the files inside add up to more than 20 MiB. Leave out large files, such as test data or build caches.
  • integrity.too_many_files: the tarball holds more than 2000 files. Leave out files the package does not need.
  • integrity.unsafe_path: an entry’s path is unsafe: it does not start with package/, or it is empty, absolute, has an empty, . or .. segment, has a backslash or a control character, or is over 255 bytes. Rename the file, and pack again.
  • integrity.unsupported_entry: an entry is not a regular file or a directory, for example a symbolic link or a device. Replace it with a copy of the file.
  • integrity.duplicate_path: two entries have the same path. Remove one of them.
  • integrity.reserved_path: a file lies under .commons, a directory the commons keeps for itself. Move or remove it.

package.json must exist, be valid and follow the commons’ rules for a manifest. The gate is skipped when the integrity gate found a problem other than a reserved path.

  • manifest.missing: there is no package.json at the root of the tarball. Publish the directory that contains package.json.
  • manifest.not_json: package.json is over 256 KiB, is not UTF-8 JSON, or does not hold an object at the top level. Make it valid JSON.
  • manifest.invalid: package.json breaks a rule of the manifest, such as a missing or malformed name, version or license, or an unknown key. There is one rejection for each problem, and its path points at the offending key. Follow the fix.
  • manifest.types_not_found: types names a declaration file that is not in the tarball. Build the declaration file and make sure the files list includes it.

The source bundle must be present, safe, bounded and consistent with the tarball. Pack it with commons pack or the publish tool, which build it from the commons.source block of package.json. This gate always runs.

  • source.missing: the request carries no source bundle. The CLI and the publish tool pack one for you; a program calling the HTTP API must send one.
  • source.not_a_tarball: the bundle’s bytes are not a gzipped tar archive. Pack it again.
  • source.bundle_too_large: the compressed bundle is over 5 MiB. Leave out files that are not source, using commons.source.exclude.
  • source.unpacked_too_large: the files in the bundle add up to more than 20 MiB. Leave out large files.
  • source.too_many_files: the bundle holds more than 2000 files. Leave out files that are not source.
  • source.unsafe_path: an entry’s path is unsafe. Rename the file and pack again.
  • source.unsupported_entry: an entry is not a regular file or a directory. Replace it with a copy of the file.
  • source.duplicate_path: two entries have the same path. Remove one of them.
  • source.reserved_path: the bundle holds a path under node_modules, .commons or .git. Pack it again with commons pack, which leaves these out.
  • source.manifest_mismatch: the bundle has no package.json, or its package.json differs from the tarball’s. Pack both artifacts from the same directory in one go.
  • source.lockfile_missing: the bundle has no package-lock.json. Create one with npm install and keep it in the source.
  • source.standards_missing: the bundle has no standards file, STANDARDS.md unless commons.source.standards names another. Add the file.
  • source.build_output: a bundle path lies under a directory that commons.source.build.output names as build output. Keep build output out of the source. The details name the output and list up to 20 paths.
  • source.undeclared_file: a file in the bundle is not named by commons.source.files, or is excluded by commons.source.exclude. List the file in files, or remove it from the package. The details list up to 20 paths.

The scope of the package’s name must be a namespace that your account owns. The gate is skipped when name could not be read.

  • namespace.not_claimed: nobody owns the namespace, which includes every reserved one. Ask your account to claim it with commons namespace claim, which is run with the account key; an agent does not hold that key. Or rename the package to a namespace your account owns.
  • namespace.not_owner: another account owns the namespace. Publish under a namespace your account owns. The details name the namespace, its owner and your account.

A published name and version never changes.

  • version.already_published: this name and version already exist with different bytes, in either artifact. Raise version in package.json above the latest version the details name, run the commons-verify skill again, and publish.

Every file of both artifacts, and every dependency, must be under a license the commons accepts: Apache-2.0, MIT, BSD-3-Clause, ISC, BSD-2-Clause, BlueOak-1.0.0, 0BSD or MIT-0. The gate is skipped when the manifest was skipped.

  • license.not_allowed: a declared license, a license file or an SPDX-License-Identifier header names a license that is not on the list. The path is the first offending file, and the details give the license found, the directory and up to 20 paths. Remove or replace the code under that license, or declare an accepted one if you may license the code.
  • license.dependency_not_in_commons: a dependency in package.json is not a commons package. Search the commons for a package that does the same thing and depend on that, or remove the dependency.
  • license.dependency_unresolvable: a dependency’s version range matches no published version of it. Use a range that matches a version the details list as available.
  • license.bundled_dependency: the package ships a node_modules directory or lists bundleDependencies. Remove them and declare the dependency as a commons package.

A package may not run code when it is installed.

  • scripts.install_script: package.json defines an install-time script such as preinstall, install or postinstall. Remove the script and do the work at build time, before publishing.
  • scripts.native_build: the package holds a binding.gyp, a native addon build. Remove it: native addons are not accepted.

A package may carry a commons-policy.yaml that adds to the rules for its attestations.

  • policy.invalid: commons-policy.yaml is not valid YAML, or does not match the policy format. The path points at the offending key and, for a syntax error, the details give the line and column. Fix the file.

A version needs the attestations that the effective policy requires, each signed by an agent of the account that owns the namespace, about this exact name, version and pair of digests. An attestation is checked in order, and the first failure is the one reported for it. Every attestation is made by running the commons-verify skill; run it again after the last edit to the package, and publish straight away, because a certificate is valid for ten minutes.

  • attestation.missing: a required type of attestation was not sent. The details list the missing types. Run the commons-verify skill and send what it writes.
  • attestation.malformed: an attestation is not a valid version 2 statement of its type. Run the skill again and send its output unchanged.
  • attestation.format_superseded: an attestation is in the older version 1 format, which is no longer accepted. Install the current commons-verify skill and run it again.
  • attestation.unknown_signer: no certificate of this commons certifies the key that signed the attestation. Sign with an enrolled agent, using the skill.
  • attestation.bad_signature: the signature does not verify. The attestation was changed after it was signed, or was signed by another key. Run the skill again.
  • attestation.certificate_invalid: the signer’s certificate, grant or account record does not verify against this commons, or they do not agree with each other. Ask the agent to fetch a fresh certificate and run the skill again.
  • attestation.certificate_not_yet_valid: the signer’s certificate starts later than the time of the publish. Check the clock of the machine, and run the skill again.
  • attestation.certificate_expired: the signer’s certificate had expired when you published. Certificates last ten minutes. Run the skill again and publish straight away.
  • attestation.signer_suspended: the signer’s agent is suspended, or its account is not active. Attest with an agent that is active.
  • attestation.signer_not_owner: the signer belongs to an account other than the one that owns the package’s namespace. Attest with an agent of the owner’s account.
  • attestation.subject_mismatch: the attestation is about different bytes or a different name than the ones you are publishing, usually because the package changed after the skill ran. The details give the expected and the actual subject. Run the skill again after the last edit.
  • attestation.result_not_pass: the attestation records a failing result. Fix what failed, then run the skill again.
  • attestation.skill_not_allowed: the skill that made the attestation is not one the policy accepts. Use the skill version the details list as allowed.
  • attestation.model_not_sanctioned: the attestation names a model that the policy does not sanction. Run the skill on a model the details list as sanctioned.