ansible/ansible · error · AnsibleError

"manifest.omit_default_directives" was set to True, but no d

Error message

"manifest.omit_default_directives" was set to True, but no directives were defined in "manifest.directives". This would produce an empty collection artifact.

What it means

Raised by _build_files_manifest_distlib when 'manifest.omit_default_directives' is True but 'manifest.directives' is empty/absent. Omitting the default directives means no files would be selected at all, producing a collection tarball with no payload — almost certainly a misconfiguration, so the build fails early instead of shipping an empty artifact.

Source

Thrown at lib/ansible/galaxy/collection/__init__.py:1116

    if manifest_control is None:
        manifest_control = {}

    try:
        control = ManifestControl(**manifest_control)
    except TypeError as ex:
        raise AnsibleError(f'Invalid "manifest" provided: {ex}')

    if not is_sequence(control.directives):
        raise AnsibleError(f'"manifest.directives" must be a list, got: {control.directives.__class__.__name__}')

    if not isinstance(control.omit_default_directives, bool):
        raise AnsibleError(
            '"manifest.omit_default_directives" is expected to be a boolean, got: '
            f'{control.omit_default_directives.__class__.__name__}'
        )

    if control.omit_default_directives and not control.directives:
        raise AnsibleError(
            '"manifest.omit_default_directives" was set to True, but no directives were defined '
            'in "manifest.directives". This would produce an empty collection artifact.'
        )

    directives = []
    if control.omit_default_directives:
        directives.extend(control.directives)
    else:
        directives.extend([
            'include meta/*.yml',
            'include *.txt *.md *.rst *.license COPYING LICENSE',
            'recursive-include .reuse **',
            'recursive-include LICENSES **',
            'recursive-include tests **',
            'recursive-include docs **.rst **.yml **.yaml **.json **.j2 **.txt **.license',
            'recursive-include roles **.yml **.yaml **.json **.j2 **.license',
            'recursive-include playbooks **.yml **.yaml **.json **.license',
            'recursive-include changelogs **.yml **.yaml **.license',

View on GitHub (pinned to 9cf16a4aca)

Solutions

  1. Add at least one directive, e.g. 'directives: ["recursive-include . **"]'
  2. Or set 'omit_default_directives: false' (or remove it) so the default include set applies

Example fix

# before (galaxy.yml)
manifest:
  omit_default_directives: true

# after (galaxy.yml)
manifest:
  omit_default_directives: true
  directives:
    - 'recursive-include plugins **'
    - 'include *.md'
Defensive patterns

Strategy: validation

Validate before calling

import yaml

def omit_has_directives(path='galaxy.yml'):
    m = yaml.safe_load(open(path)).get('manifest') or {}
    return not (m.get('omit_default_directives') and not m.get('directives'))

Prevention

When it happens

Trigger: galaxy.yml with 'manifest: {omit_default_directives: true}' and no 'directives' key, or an empty 'directives: []'.

Common situations: Enabling the flag as scaffolding 'for later' without adding directives; deleting directives while debugging and forgetting to restore them.

Related errors


AI-assisted analysis of ansible/ansible@9cf16a4aca (2026-08-15). Data as JSON: /api/errors/ba8bdbfbbf536fe8. Report an issue: GitHub.