# Parse error when publishing to Galaxy

**URL:** <https://forum.ansible.com/t/parse-error-when-publishing-to-galaxy/44386>\
**Category:** Get Help\
**Tags:** galaxy, ansible-devel, collections, galaxy-ng\
**Created:** [August 28, 2025, 6:06pm UTC](https://forum.ansible.com/t/parse-error-when-publishing-to-galaxy/44386 "2025-08-28T18:06:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![stemid](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/stemid/32/9338_2.png) [@stemid](https://forum.ansible.com/u/stemid)\
**Post date:** [August 28, 2025, 6:06pm UTC](https://forum.ansible.com/t/parse-error-when-publishing-to-galaxy/44386/1 "2025-08-28T18:06:40Z")

</div>

I just made my first Ansible collection but I’m getting this parse error when publishing it to Galaxy and I cannot figure out what is wrong with my DOCUMENTATION string.

```auto
ERROR! module stemid.powerdns.powerdns_record missing documentation (or could not parse documentation): stemid.powerdns.powerdns_record did not contain a DOCUMENTATION attribute
(/tmp/tmph46fhlgo/ansible_collections/stemid/powerdns/plugins/modules/powerdns_record.py). Unable to parse documentation in python file \'/tmp/tmph46fhlgo/ansible_collections/stemid/powerdns/plugins/modules/powerdns_record.py\': while parsing a block mapping\n in
"<unicode string>", line 7, column 5\ndid not find expected key\n in "<unicode string>", line 7, column 43. while parsing a block mapping\n in "<unicode string>", line 7, column 5\ndid not find expected key\n in "<unicode string>", line 7, column 43\n'

```

You can see the DOCUMENTATION block in question here on [gitlab.com](http://gitlab.com): [plugins/modules/powerdns\_record.py · main · Stefan Midjich / ansible-collection-powerdns · GitLab](https://gitlab.com/stemid/ansible-collection-powerdns/-/blob/main/plugins/modules/powerdns_record.py?ref_type=heads)

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [August 28, 2025, 6:31pm UTC](https://forum.ansible.com/t/parse-error-when-publishing-to-galaxy/44386/2 "2025-08-28T18:31:13Z")

</div>

Welcome to the forum, @stemid!

Did you run `ansible-test sanity --docker -v` first? I would assume that doesn’t pass either. It usually gives you better indications (not all of the tests, but its `yamllint` test will likely give you a more precise location).

The error is in `RETURN`, which is invalid YAML. The trailing comma in line 140 is the first error which makes it invalid.

---

<div class="post-metadata">

**Author:** ![flowerysong](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/flowerysong/32/2305_2.png) [@flowerysong](https://forum.ansible.com/u/flowerysong)\
**Post date:** [August 28, 2025, 6:33pm UTC](https://forum.ansible.com/t/parse-error-when-publishing-to-galaxy/44386/3 "2025-08-28T18:33:04Z")

</div>

Your `RETURN` documentation is invalid, in a spot (line 6, column 43) that lines up pretty well with the error:

```yaml
record:
  description: A dictionary representing the PowerDNS record.
  type: dict
  returned: always
  sample:
    "name": "host01.internal.example.com.",
    "type": "A",
    "ttl": 86400,
    "records": [
        {
            "content": "192.168.1.234",
            "disabled": false
        }
    ],
    "comments": []

```

You can’t mix flow-style collection syntax into a block-style collection. The idiomatic way to write this would be:

```yaml
record:
  description: A dictionary representing the PowerDNS record.
  type: dict
  returned: always
  sample:
    name: host01.internal.example.com.
    type: A
    ttl: 86400
    records:
      - content: 192.168.1.234
        disabled: false
    comments: []

```

Or, if you really want to do flow-style, add the missing delimiters:

```yaml
record:
  description: A dictionary representing the PowerDNS record.
  type: dict
  returned: always
  sample: {
    "name": "host01.internal.example.com.",
    "type": "A",
    "ttl": 86400,
    "records": [
        {
            "content": "192.168.1.234",
            "disabled": false
        }
    ],
    "comments": []
  }

```

---

<div class="post-metadata">

**Author:** ![stemid](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/stemid/32/9338_2.png) [@stemid](https://forum.ansible.com/u/stemid)\
**Post date:** [August 29, 2025, 6:44am UTC](https://forum.ansible.com/t/parse-error-when-publishing-to-galaxy/44386/4 "2025-08-29T06:44:01Z")

</div>

Thanks to both of you for teaching me about how to develop collections.

The issue was indeed in the RETURN statement.

I just took both DOCUMENTATION and RETURN out into a yaml file and ran yamllint on them until I was rid of all the errors. Now I have published a new file without errors.

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [August 29, 2025, 4:27pm UTC](https://forum.ansible.com/t/parse-error-when-publishing-to-galaxy/44386/5 "2025-08-29T16:27:27Z")

</div>

There’s no need to run `yamllint` manually on files that contain copy’n’pasted parts of modules, when you can simply run `ansible-test sanity --docker -v` (with `--test yamllint` if you only want that test) 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [September 28, 2025, 4:28pm UTC](https://forum.ansible.com/t/parse-error-when-publishing-to-galaxy/44386/6 "2025-09-28T16:28:18Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
