Unsupported type "ptr" Warning

Hello. New to Hugo. I’ve been working on it for a couple of weeks, so starting to find my way around. Stuck trying to address the following warning. Any ideas where to begin? Thanks.

[Hugo] WARNING: calling IsSet with unsupported type “ptr” (*hugolib.pageState) will always return false.

Since we do not know what your exact code is, not sure how to answer this.
Take a look at this previous topic and see if it helps you in your case:

Thanks @Shashank. I guess the question should have been: how on earth do I work out which file/line the warning refers to? It’s a large Hugo project now, with tonnes of issets. If I just knew which file resulted in the warning…

Hugo usually states where the warning or error is occurring. Check above or below the warning.
If you cannot find anything on the build log, you can try to search isSet in your directories to narrow down to the files that are using this function. From there on, it is more like going through those files to see which is more likely to throw this error.

Hi Shashank. Unfortunately this is as much detail as I get at the terminal.

Did you try to search your workspace for the word IsSet?

Hi @Shashank, I have. was hoping to avoid the brute force approach to commenting out each instance one at a time, until I narrow it down to the culprit:

Yes, I agree that this is a bit troublesome.
Which version of Hugo are you using?
The {{ if isset . }} way of checking and using parameters is an old style of coding templates in Hugo. It is replaced by the {{ with parametername }}.
Is this code written by you or is this code from a particular theme that you are using?

Hi @Shashank. Currently on 0.74.3. Will try to make use of {{ with }} rather than {{ if }} throughout my code, but where I’m using {{if}}/{{else}}, will not be able to switch to {{with}}.

It is not imperative that you use {{ with }}instead of {{ if }}.
The main thing is {{ with }} takes away the need to check for isSet. The statements in {{ with }} block would be executed only if the value is set, otherwise it would not execute the block.
I agree that it may be difficult to implement a {{ with }} block where your logical flow would branch out in two different directions. However, it is advised to make use of else as little as possible.
Nevertheless, did you find the code that was causing the warning to show? Please post here if you did, and how you found it.

Hi @Shashank. I’m afraid I haven’t been able to isolate the source of the warning. On a big project, it’s difficult to narrow down warnings like the following without file names/line numbers. Looks like I’m stuck with it for now.

[Hugo] WARNING: calling IsSet with unsupported type "ptr" (*hugolib.pageState) will always return false.

Based on your screen capture, this line is causing the problem:

{{- $title := cond (isset . "Title") .Title $.Site.Title -}}

Thank you @jmooring, I’ll focus on that line.