The symptom you describe is most commonly associated with a mismatch between the source data and the data for the symbol you have loaded on the chart. So that's where I began my investigation. Sure enough, we find the data for symbols "DGS3MO:FRED" and "DGS10:FRED" are posted one day behind the rest of the market. Since the data for those symbols is always one day behind, there is no data available for the current day.
How did I work this out? I loaded one of those ticker symbols on a daily chart. Then I loaded a regular stock ticker on another daily chart. The stock ticker shows the last candle on the chart is dated 11/23/22. However the chart for the "DGS3MO:FRED" ticker symbol shows the last candle on the chart is dated 11/22/22.
Your code is referencing the current bar. And when you try to read the current value for 11/23/22, ticker symbol "DGS3MO:FRED" has no data there to be read. So the label correctly reports N/A instead of a value.
The easiest solution is to update your code to read from the previous daily bar instead of the current. However this solution will now only report the correct value when you have loaded a stock, futures, or forex symbol on the chart.
input symbolOne = "DGS3MO:FRED";
input symbolTwo = "DGS10:FRED";
def yieldOne = close(symbolOne, period = AggregationPeriod.DAY);
def yieldTwo = close(symbolTwo, period = AggregationPeriod.DAY);
def yieldCurve = yieldTwo - yieldOne;
AddLabel(yes, Concat("Yield Curve:", (yieldCurve[1])), Color.VIOLET);
Notice I have also cleaned up the code to provide a more appropriate method for naming variables.