ansible/ansible · error · AnsibleError

Invalid "manifest" provided: {ex}

Error message

Invalid "manifest" provided: {ex}

What it means

Raised by _build_files_manifest_distlib when constructing ManifestControl(**manifest_control) from the galaxy.yml 'manifest' value raises TypeError — i.e. the mapping contains keys that are not fields of ManifestControl (only 'directives' and 'omit_default_directives' are recognized). The original TypeError text is embedded so the offending key is visible.

Source

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

    manifest['files'].sort(key=itemgetter('name'))

    return manifest


def _build_files_manifest_distlib(b_collection_path, namespace, name, manifest_control,
                                  license_file):
    # type: (bytes, str, str, dict[str, t.Any], t.Optional[str]) -> FilesManifestType
    if not HAS_DISTLIB:
        raise AnsibleError('Use of "manifest" requires the python "distlib" library')

    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:

View on GitHub (pinned to 9cf16a4aca)

Solutions

  1. Inspect the TypeError text in the message — it names the unexpected keyword argument(s)
  2. Restrict 'manifest' to the supported keys: 'directives' (list of strings) and 'omit_default_directives' (bool)
  3. Validate galaxy.yml against the current collection template/docs after upgrading ansible-core

Example fix

# before (galaxy.yml)
manifest:
  directive:
    - 'recursive-include roles **'

# after (galaxy.yml)
manifest:
  directives:
    - 'recursive-include roles **'
Defensive patterns

Strategy: validation

Validate before calling

import yaml

ALLOWED = {'directives', 'omit_default_directives'}

def manifest_keys_ok(path='galaxy.yml'):
    manifest = yaml.safe_load(open(path)).get('manifest') or {}
    bad = set(manifest) - ALLOWED
    assert not bad, f'unexpected manifest keys: {bad}'

Prevention

When it happens

Trigger: A galaxy.yml like 'manifest: {directive: [...]}' (typo'd singular key), or extra keys such as 'manifest: {directives: [...], strict: true}'. Constructing the dataclass with an unexpected kwarg raises TypeError, which is converted to this AnsibleError.

Common situations: Typos in manifest keys; copy/pasting draft documentation or blog examples that used different key names; leftover experimental keys from older proposals.

Related errors


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