# Variable has coerced Null value for NonNull type 'String!'

**URL:** <https://community.postman.com/t/variable-has-coerced-null-value-for-nonnull-type-string/70828>\
**Category:** Help Hub\
**Tags:** variables\
**Created:** [November 5, 2024, 10:57am UTC](https://community.postman.com/t/variable-has-coerced-null-value-for-nonnull-type-string/70828 "2024-11-05T10:57:36Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![hostfullysupport](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/hostfullysupport/32/30618_2.png) [@hostfullysupport](https://community.postman.com/u/hostfullysupport)\
**Post date:** [November 5, 2024, 10:57am UTC](https://community.postman.com/t/variable-has-coerced-null-value-for-nonnull-type-string/70828/1 "2024-11-05T10:57:36Z")

</div>

Hi all,

I’m hoping you can help me with an issue related to the variable used in a GraphQL request.

I loaded the GraphQL schema using introspection and created a variable for the collection to run tests. However, the variable is showing a null value in the query, which leads to a validation error: “Variable ‘propertyUid’ has coerced Null value for NonNull type ‘String!’”.

Any insights on what might be causing this or how to resolve it would be greatly appreciated!

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/a/8/a8ac499fbc24d6ef185a117a8583382b3860885c.png)

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/e/3/e377f5bec6451da98b5d259999dff10cac31f736.png)

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [November 5, 2024, 11:49am UTC](https://community.postman.com/t/variable-has-coerced-null-value-for-nonnull-type-string/70828/2 "2024-11-05T11:49:11Z")

</div>

Hey 👋

Welcome to the Postman Community! :postman:

One question, have you saved the Collection variable? I can see from the image that it has unsaved changes in there.

If you enable autosave, from the General Settings - Does this help?

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/3/c/3cd05baa51557e4a4d37e9bcdb0a2c3444b5ff08.png)

---

<div class="post-metadata">

**Author:** ![hostfullysupport](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/hostfullysupport/32/30618_2.png) [@hostfullysupport](https://community.postman.com/u/hostfullysupport)\
**Post date:** [November 5, 2024, 12:03pm UTC](https://community.postman.com/t/variable-has-coerced-null-value-for-nonnull-type-string/70828/3 "2024-11-05T12:03:05Z")

</div>

Hi Danny, I have saved the variable as well as enabled autosave, but the validation error pesists, any suggestions?

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/d/c/dca147cd287be15fdb3eb0c90078b5facdecea8c.png)  
 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/6/f/6ff83b8607e3071000031d57d8eaf0166be0305b.png)  
 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/6/6/66ed552cf5aaabd208bfff4b1e7b465d2904983f.png)

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [November 5, 2024, 12:22pm UTC](https://community.postman.com/t/variable-has-coerced-null-value-for-nonnull-type-string/70828/4 "2024-11-05T12:22:54Z")

</div>

Does it work as expected when you hardcode a value into the variable?

The example this use in their [documentation](https://dev.hostfully.com/reference/hostfully-graphql-api) is slightly different from yours:

```auto
query {
  property(uid: "${propertyUid}") {
    uid
    agencyUid
    name
    isActive
    pictureLink
    webLink
    bedrooms
    beds
    bathrooms
    numberOfFloors
    rentalLicenseNumber
    rentalLicenseExpirationDate
  }
}

```

I’d be lying if I said I know a ton about GraphQL to be honest 😅

---

<div class="post-metadata">

**Author:** ![hostfullysupport](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/hostfullysupport/32/30618_2.png) [@hostfullysupport](https://community.postman.com/u/hostfullysupport)\
**Post date:** [November 5, 2024, 12:27pm UTC](https://community.postman.com/t/variable-has-coerced-null-value-for-nonnull-type-string/70828/5 "2024-11-05T12:27:28Z")

</div>

Hi Danny, if I dont use the variable and add the value of the propertyUid directly in the query, it works, so I am having issue with how the variable is used in Postman ☹

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/e/9/e9adcd6c8a887f2d5b1df0f169d752915d8c3354.png)

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [November 5, 2024, 12:30pm UTC](https://community.postman.com/t/variable-has-coerced-null-value-for-nonnull-type-string/70828/6 "2024-11-05T12:30:17Z")

</div>

Sorry, I meant if you hardcode that in the variable section itself (replacing the postman variable syntax).

---

<div class="post-metadata">

**Author:** ![hostfullysupport](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/hostfullysupport/32/30618_2.png) [@hostfullysupport](https://community.postman.com/u/hostfullysupport)\
**Post date:** [November 5, 2024, 12:51pm UTC](https://community.postman.com/t/variable-has-coerced-null-value-for-nonnull-type-string/70828/7 "2024-11-05T12:51:21Z")

</div>

Is it what you means? I still get the same error

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/f/6/f6ef965644df180379bd7b4ddef1eeb38ee32f30.png)

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [November 5, 2024, 2:38pm UTC](https://community.postman.com/t/variable-has-coerced-null-value-for-nonnull-type-string/70828/8 "2024-11-05T14:38:32Z")

</div>

Hmm…

I’m not sure what’s happening there from that API - using our echo service I’m able to use a Collection level variable as a GraphQL Variable, which is resolved in the query 🤔

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/e/f/efca5c8665508f40a101547f20b8c416536144ac.jpeg)

---

<div class="post-metadata">

**Author:** ![meenakshi.dhanani](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/meenakshi.dhanani/32/5980_2.png) [@meenakshi.dhanani](https://community.postman.com/u/meenakshi.dhanani)\
**Post date:** [November 6, 2024, 10:37am UTC](https://community.postman.com/t/variable-has-coerced-null-value-for-nonnull-type-string/70828/9 "2024-11-06T10:37:06Z")

</div>

Hello 👋,  
I tried it too, I am unable to reproduce the error, but I created a public collection, in case you want to make changes to it or compare it with the API you have - [GraphQL request using variables](https://www.postman.com/test-meena/meena-s-public-workspace/graphql-request/672b428d181ed87f4d4f026f)

Also, I see in this screenshot that the Property object has two uids - one with String! and the other with String, that seems confusing, I’m not sure if that’s probably an issue. Could you try using the variable for another field? like say “name” and see if the problem still persists?

---

<div class="post-metadata">

**Author:** ![hostfullysupport](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/hostfullysupport/32/30618_2.png) [@hostfullysupport](https://community.postman.com/u/hostfullysupport)\
**Post date:** [November 6, 2024, 2:28pm UTC](https://community.postman.com/t/variable-has-coerced-null-value-for-nonnull-type-string/70828/10 "2024-11-06T14:28:36Z")

</div>

I think that’s probably the issue from API provider, I will contact them for further insight. Thanks for your help

---

<div class="post-metadata">

**Author:** ![hostfullysupport](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/hostfullysupport/32/30618_2.png) [@hostfullysupport](https://community.postman.com/u/hostfullysupport)\
**Post date:** [November 6, 2024, 2:29pm UTC](https://community.postman.com/t/variable-has-coerced-null-value-for-nonnull-type-string/70828/11 "2024-11-06T14:29:02Z")

</div>

Thanks for your help Danny. I think that’s probably the issue from API provider, I will contact them for further insight.

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [November 12, 2024, 4:38pm UTC](https://community.postman.com/t/variable-has-coerced-null-value-for-nonnull-type-string/70828/12 "2024-11-12T16:38:21Z")

</div>

For future debugging purposes, I always look at the requests that were sent in the console. That way I can see what my variables are resolving to. The console shows all the sent requests along with the request/response bodies and headers. This would be worth checking out if you don’t hear from the API maintainer.

Another thing to check is if the property id you’re using exists in the system, it could just be an unfriendly “not found” error response

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [December 12, 2024, 4:38pm UTC](https://community.postman.com/t/variable-has-coerced-null-value-for-nonnull-type-string/70828/13 "2024-12-12T16:38:40Z")

</div>

Closed on December 12, 2024, 4:38pm UTC

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