Post API on available IP in prefix (/32) marked fully utilized #8303

Closed
opened 2025-12-29 20:35:07 +01:00 by adam · 2 comments
Owner

Originally created by @Etibru on GitHub (Jul 6, 2023).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.5.4

Python version

3.10

Steps to Reproduce

  1. Create prefixes (ex: 10.10.10.1/32) and check "Mark utilized"
  2. From the API, use endpoint "/api/ipam/prefixes/{id}/available-ips/" with Request body empty or not
    ==> Error 500: Internal Server Error

Problem found on netbox version 3.4.8 and tested if still pressing on latest version

Expected Behavior

We would like to have the IP created back

Observed Behavior

Error Error 500: Internal Server Error

{
  "error": "'list' object has no attribute 'size'",
  "exception": "AttributeError",
  "netbox_version": "3.5.4",
  "python_version": "3.10.6"
}

Or in netbox version 3.4.8 :
erreur 500 : Internal server Error

<!DOCTYPE html>
<html lang="en">

<head>
    <title>Server Error</title>
    <link rel="stylesheet" href="/static/netbox-light.css" />
    <meta charset="UTF-8">
</head>

<body>
    <div class="container-fluid">
        <div class="row">
            <div class="col col-md-6 offset-md-3">
                <div class="card border-danger mt-5">
                    <h5 class="card-header">
                        <i class="mdi mdi-alert"></i> Server Error
                    </h5>
                    <div class="card-body">
                        
                            <p>
                                There was a problem with your request. Please contact an administrator.
                            </p>
                        
                        <hr />
                        <p>
                            The complete exception is provided below:
                        </p>
<pre class="block"><strong>&lt;class &#x27;AttributeError&#x27;&gt;</strong><br />
&#x27;list&#x27; object has no attribute &#x27;size&#x27;

Python version: 3.10.6
NetBox version: 3.4.8</pre>
                        <p>
                            If further assistance is required, please post to the <a href="https://github.com/netbox-community/netbox/discussions">NetBox discussion forum</a> on GitHub.
                        </p>
                        <div class="text-end">
                            <a href="/" class="btn btn-primary">Home Page</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>

</html>
Originally created by @Etibru on GitHub (Jul 6, 2023). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.5.4 ### Python version 3.10 ### Steps to Reproduce 1. Create prefixes (ex: 10.10.10.1/32) **and check "Mark utilized"** 2. From the API, use endpoint "/api/ipam/prefixes/{id}/available-ips/" with Request body empty or not ==> Error 500: Internal Server Error Problem found on netbox version 3.4.8 and tested if still pressing on latest version ### Expected Behavior We would like to have the IP created back ### Observed Behavior Error Error 500: Internal Server Error ```json { "error": "'list' object has no attribute 'size'", "exception": "AttributeError", "netbox_version": "3.5.4", "python_version": "3.10.6" } ``` Or in netbox version 3.4.8 : erreur 500 : Internal server Error ```html <!DOCTYPE html> <html lang="en"> <head> <title>Server Error</title> <link rel="stylesheet" href="/static/netbox-light.css" /> <meta charset="UTF-8"> </head> <body> <div class="container-fluid"> <div class="row"> <div class="col col-md-6 offset-md-3"> <div class="card border-danger mt-5"> <h5 class="card-header"> <i class="mdi mdi-alert"></i> Server Error </h5> <div class="card-body"> <p> There was a problem with your request. Please contact an administrator. </p> <hr /> <p> The complete exception is provided below: </p> <pre class="block"><strong>&lt;class &#x27;AttributeError&#x27;&gt;</strong><br /> &#x27;list&#x27; object has no attribute &#x27;size&#x27; Python version: 3.10.6 NetBox version: 3.4.8</pre> <p> If further assistance is required, please post to the <a href="https://github.com/netbox-community/netbox/discussions">NetBox discussion forum</a> on GitHub. </p> <div class="text-end"> <a href="/" class="btn btn-primary">Home Page</a> </div> </div> </div> </div> </div> </div> </body> </html> ```
adam added the type: bugstatus: acceptedseverity: medium labels 2025-12-29 20:35:07 +01:00
adam closed this issue 2025-12-29 20:35:08 +01:00
Author
Owner

@abhi1693 commented on GitHub (Jul 6, 2023):

Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

@abhi1693 commented on GitHub (Jul 6, 2023): Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.
Author
Owner

@Etibru commented on GitHub (Jul 6, 2023):

In just two steps and from a newly installed version of netbox, the bug goes back up.
I repeat my steps
1- Create a prefix (from the web or API), make sure the "Mark utilized" box is checked.
2- From the API and on this endpoint "/api/ipam/prefixes/{id}/available-ips/" (with the id corresponding to the prefix previously created) perform a POST, with the Request body empty or not.

The procedure with curl

  1. Create prefix:
curl -X 'POST' \
  'http://localhost:8000/api/ipam/prefixes/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'X-CSRFTOKEN: m0i3TRrAfE1UNCRRx4vFMZQ8ZdJ6o2ZvmbIG2gjUpnEAU71IFjAO5VJsLq7LnPkB' \
  -d '{
  "prefix": "10.10.10.1/32",
  "mark_utilized": true
}'

response:

{
  "id": 3,
  "url": "http://localhost:8000/api/ipam/prefixes/3/",
  "display": "10.10.10.1/32",
  "prefix": "10.10.10.1/32",
  "site": null,
  "vrf": null,
  "tenant": null,
  "vlan": null,
  "status": {
    "value": "active",
    "label": "Active"
  },
  "role": null,
  "is_pool": false,
  "mark_utilized": true,
  "description": "",
  "comments": "",
  "tags": [],
  "custom_fields": {},
  "created": "2023-07-06T15:00:36.951408Z",
  "last_updated": "2023-07-06T15:00:36.951423Z",
  "children": 0,
  "_depth": 0
}
  1. Post an IP address object in prefix
curl -X 'POST' \
  'http://localhost:8000/api/ipam/prefixes/3/available-ips/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'X-CSRFTOKEN: m0i3TRrAfE1UNCRRx4vFMZQ8ZdJ6o2ZvmbIG2gjUpnEAU71IFjAO5VJsLq7LnPkB' \
  -d '{}'

response:

{
  "error": "'list' object has no attribute 'size'",
  "exception": "AttributeError",
  "netbox_version": "3.5.4",
  "python_version": "3.10.6"
}
@Etibru commented on GitHub (Jul 6, 2023): In just two steps and from a newly installed version of netbox, the bug goes back up. I repeat my steps 1- Create a prefix (from the web or API), make sure the "**_Mark utilized_**" box is **checked**. 2- From the API and on this endpoint "/api/ipam/prefixes/{id}/available-ips/" (with the id corresponding to the prefix previously created) perform a POST, with the Request body empty or not. ### The procedure with curl 1. Create prefix: ```curl curl -X 'POST' \ 'http://localhost:8000/api/ipam/prefixes/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -H 'X-CSRFTOKEN: m0i3TRrAfE1UNCRRx4vFMZQ8ZdJ6o2ZvmbIG2gjUpnEAU71IFjAO5VJsLq7LnPkB' \ -d '{ "prefix": "10.10.10.1/32", "mark_utilized": true }' ``` response: ```json { "id": 3, "url": "http://localhost:8000/api/ipam/prefixes/3/", "display": "10.10.10.1/32", "prefix": "10.10.10.1/32", "site": null, "vrf": null, "tenant": null, "vlan": null, "status": { "value": "active", "label": "Active" }, "role": null, "is_pool": false, "mark_utilized": true, "description": "", "comments": "", "tags": [], "custom_fields": {}, "created": "2023-07-06T15:00:36.951408Z", "last_updated": "2023-07-06T15:00:36.951423Z", "children": 0, "_depth": 0 } ``` 2. Post an IP address object in prefix ```curl curl -X 'POST' \ 'http://localhost:8000/api/ipam/prefixes/3/available-ips/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -H 'X-CSRFTOKEN: m0i3TRrAfE1UNCRRx4vFMZQ8ZdJ6o2ZvmbIG2gjUpnEAU71IFjAO5VJsLq7LnPkB' \ -d '{}' ``` response: ```json { "error": "'list' object has no attribute 'size'", "exception": "AttributeError", "netbox_version": "3.5.4", "python_version": "3.10.6" } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8303