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.
integrity
Section titled “integrity”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 ofcommons 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 withpackage/, 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.
manifest
Section titled “manifest”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 nopackage.jsonat the root of the tarball. Publish the directory that containspackage.json.manifest.not_json:package.jsonis 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.jsonbreaks a rule of the manifest, such as a missing or malformedname,versionorlicense, or an unknown key. There is one rejection for each problem, and itspathpoints at the offending key. Follow thefix.manifest.types_not_found:typesnames a declaration file that is not in the tarball. Build the declaration file and make sure thefileslist includes it.
source
Section titled “source”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 thepublishtool 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, usingcommons.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 undernode_modules,.commonsor.git. Pack it again withcommons pack, which leaves these out.source.manifest_mismatch: the bundle has nopackage.json, or itspackage.jsondiffers from the tarball’s. Pack both artifacts from the same directory in one go.source.lockfile_missing: the bundle has nopackage-lock.json. Create one withnpm installand keep it in the source.source.standards_missing: the bundle has no standards file,STANDARDS.mdunlesscommons.source.standardsnames another. Add the file.source.build_output: a bundle path lies under a directory thatcommons.source.build.outputnames as build output. Keep build output out of the source. Thedetailsname the output and list up to 20 paths.source.undeclared_file: a file in the bundle is not named bycommons.source.files, or is excluded bycommons.source.exclude. List the file infiles, or remove it from the package. Thedetailslist up to 20 paths.
namespace
Section titled “namespace”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 withcommons 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. Thedetailsname the namespace, its owner and your account.
version
Section titled “version”A published name and version never changes.
version.already_published: this name and version already exist with different bytes, in either artifact. Raiseversioninpackage.jsonabove thelatestversion thedetailsname, run thecommons-verifyskill again, and publish.
license
Section titled “license”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 anSPDX-License-Identifierheader names a license that is not on the list. Thepathis the first offending file, and thedetailsgive 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 inpackage.jsonis 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 thedetailslist as available.license.bundled_dependency: the package ships anode_modulesdirectory or listsbundleDependencies. Remove them and declare the dependency as a commons package.
scripts
Section titled “scripts”A package may not run code when it is installed.
scripts.install_script:package.jsondefines an install-time script such aspreinstall,installorpostinstall. Remove the script and do the work at build time, before publishing.scripts.native_build: the package holds abinding.gyp, a native addon build. Remove it: native addons are not accepted.
policy
Section titled “policy”A package may carry a commons-policy.yaml that adds to the rules for its attestations.
policy.invalid:commons-policy.yamlis not valid YAML, or does not match the policy format. Thepathpoints at the offending key and, for a syntax error, thedetailsgive the line and column. Fix the file.
attestation
Section titled “attestation”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. Thedetailslist the missing types. Run thecommons-verifyskill 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 currentcommons-verifyskill 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. Thedetailsgive 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 thedetailslist as allowed.attestation.model_not_sanctioned: the attestation names a model that the policy does not sanction. Run the skill on a model thedetailslist as sanctioned.