Getting an error 'Trying to access array offset on value of type null' on trying to get field blueprint options of type 'select'

I have a field blueprint with the filename ‘budget.yml’ in the ‘fields’ folder –

label: Budget
type: select
options:
	- Less than 1 crore
	- 1-2 crores
	- 2-3 crores
	- 3-5 crores
	- 5-7 crores
	- 7-10 crores
	- 10-20 crores
	- 20-30 crores
	- 30-50 crores
	- More than 50 crores

It is being used in the ‘site.yml’ file like this as I want to use the options above as input checkbox and label values –

sections:
	pages:
		type: pages
		max: 5
	other:
		type: fields
		fields:
			budget
				extends: fields/budget
				type: hidden

I’m using getting those options like this –

<?php
    $budgets = $site->blueprint()->field('budget');
    $budget = $budgets['options'];
    $bl = count($budget);
                            
    for ($bc = 0; $bc < $bl; $bc++) {
        echo "<input type='checkbox' value='$budget[$bc]'>";
        echo "<label> $budget[$bc]</label><br>";
    }
?>

But, I get an error – ‘Trying to access array offset on value of type null’. I’m using the exact same PHP code as above to get the options from other field blueprints and they work absolutely fine. It’s only this field that is creating the problem.

A hidden field doesn’t have an options property, you cannot change the field type when extending the field.

But I have other fields that are also hidden in the panel by using type: hidden like above and I can get their options just fine. I removed the type: hidden from all the fields as well but that still didn’t work.

Turns out there was a colon missing after ‘budget’ :sweat_smile:

sections:
	pages:
		type: pages
		max: 5
	other:
		type: fields
		fields:
			budget:
				extends: fields/budget
				type: hidden

Works absolutely fine now!