Database Error: FRED library error: 'Internal Server Error' in "FETCH ..."

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

rod_jensen
Posts: 9
Joined: Sat Jan 15, 2011 1:40 pm

Database Error: FRED library error: 'Internal Server Error' in "FETCH ..."

Postby rod_jensen » Tue Apr 07, 2026 3:20 pm

Dear EViews:

I keep getting an error along these lines when executing an EViews program against the FRED database (using FETCH). The error always reads something like this (regardless of when/where in the series FETCH process it occurs):

Database Error: FRED library error: 'Internal Server Error' in "FETCH ..."

Here's an instance of an entire error message of this nature I got earlier this afternoon:

Database Error: FRED library error: 'Internal Server Error' in "FETCH IPMAN" in MONTHLY_ECONOMIC_DATA_04072026.PRG on line 46.

This error type (though not necessarily with the same FRED series) has been happening continuously, now, for some 5 to 6 days, maybe more.

Are you folks there at EViews seeing this, too, and do you possibly have an explanation and a solution for it?

Thanks very much,
Rod Jensen

P.S. I'm happy to provide you with an instance of a program in which the error occurs, if you might need it.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13585
Joined: Tue Sep 16, 2008 5:38 pm

Re: Database Error: FRED library error: 'Internal Server Error' in "FETCH ..."

Postby EViews Gareth » Tue Apr 07, 2026 5:07 pm

No issues here. We might need more details.

Image

rod_jensen
Posts: 9
Joined: Sat Jan 15, 2011 1:40 pm

Re: Database Error: FRED library error: 'Internal Server Error' in "FETCH ..."

Postby rod_jensen » Thu Apr 09, 2026 9:26 am

ok, thank you. For testing purposes, I've attached these 6 text files:
tickers_annual.txt
tickers_bls_cpi_food.txt
tickers_daily.txt
tickers_monthly.txt
tickers_quarterly.txt
tickers_weekly.txt

And here is a skinnied-down version of the program:

'Date: Thurs. 4/9/2026
' EViews 14 test program for fetching FRED data series

' Create the workfile container (no dated page yet)
wfcreate(wf=Economic_Data_04082026) u 1

' Create data pages per data periodicity (daily, weekly, monthly, annual, etc.)
pagecreate(page=daily_stock_indexes) d5 10/1/1928 12/31/2026
pagecreate(page=daily_funds) d5 10/1/1928 12/31/2026
pagecreate(page=daily_data) d5 1/3/1950 12/31/2026
pagecreate(page=weekly_data) w 1/7/1967 12/31/2026
pagecreate(page=monthly_data) m 1919m1 2026m12
pagecreate(page=quarterly_data) q 1919q1 2026q4
pagecreate(page=annual_data) a 1790 2026
pagecreate(page=bls_cpi_food) m 1913m1 2026m12

' Create an undated page for ticker import
pagecreate(page=tickers_page) u 5000

' Switch to the undated ticker page
pageselect tickers_page

' Import the daily ticker list as alpha
%file = "C:\Temp\tickers_daily.txt"
import(type=txt, colhead=none, name=series01, format=alpha) {%file}
rename series01 daily_series

' Import the weekly ticker list as alpha
%file = "C:\Temp\tickers_weekly.txt"
import(type=txt, colhead=none, name=series01, format=alpha) {%file}
rename series01 weekly_series

' Import the monthly ticker list as alpha
%file = "C:\Temp\tickers_monthly.txt"
import(type=txt, colhead=none, name=series01, format=alpha) {%file}
rename series01 monthly_series

' Import the quarterly ticker list as alpha
%file = "C:\Temp\tickers_quarterly.txt"
import(type=txt, colhead=none, name=series01, format=alpha) {%file}
rename series01 quarterly_series

' Import the annual ticker list as alpha
%file = "C:\Temp\tickers_annual.txt"
import(type=txt, colhead=none, name=series01, format=alpha) {%file}
rename series01 annual_series

' Import the bls cpi food ticker list as alpha
%file = "C:\Temp\tickers_bls_cpi_food.txt"
import(type=txt, colhead=none, name=series01, format=alpha) {%file}
rename series01 bls_cpi_food_series

' This next section loops through each ticker series, fetches FRED time-series data per ticker, then places the data onto the associated data page
' Open FRED once
dbopen(type=fred)

' DAILY TICKERS
' Loop through the daily tickers
for !i = 1 to 5000
' Go to tickers page and read the i-th ticker
pageselect tickers_page
%ticker = daily_series(!i)
if %ticker = "" then
exitloop
endif

' Go to daily data page and fetch that ticker
pageselect daily_data
fetch {%ticker}

next

' WEEKLY TICKERS
' Loop through the weekly tickers
for !i = 1 to 5000
' Go to tickers page and read the i-th ticker
pageselect tickers_page
%ticker = weekly_series(!i)
if %ticker = "" then
exitloop
endif

' Go to daily data page and fetch that ticker
pageselect weekly_data
fetch {%ticker}

next

' MONTHLY TICKERS
' Loop through the monthly tickers
for !i = 1 to 5000

' Go to tickers page and read the i-th ticker
pageselect tickers_page
%ticker = monthly_series(!i)
if %ticker = "" then
exitloop
endif

' Go to monthly page and fetch that ticker
pageselect monthly_data
fetch {%ticker}

next

' QUARTERLY TICKERS
' Loop through the quarterly tickers
for !i = 1 to 5000

' Go to tickers page and read the i-th ticker
pageselect tickers_page
%ticker = quarterly_series(!i)
if %ticker = "" then
exitloop
endif

' Go to annual page and fetch that ticker
pageselect quarterly_data
fetch {%ticker}

next

' ANNUAL TICKERS
' Loop through the annual tickers
for !i = 1 to 5000

' Go to tickers page and read the i-th ticker
pageselect tickers_page
%ticker = annual_series(!i)
if %ticker = "" then
exitloop
endif

' Go to annual page and fetch that ticker
pageselect annual_data
fetch {%ticker}

next

' BLS CPI FOOD TICKERS (tracking food inflation in djt's 2nd admin)
' Loop through the bls cpi food tickers
for !i = 1 to 5000

' Go to tickers page and read the i-th ticker
pageselect tickers_page
%ticker = bls_cpi_food_series(!i)
if %ticker = "" then
exitloop
endif

' Go to bls cpi food data page and fetch that ticker
pageselect bls_cpi_food
fetch {%ticker}

next

The first time I attempted to run it this morning (in Quiet mode), I got this error message:
Database Error: FRED library error: 'Internal Server Error' in "FETCH CC4WSA" on line 98.

The second time I attempted to run it this morning (in Quiet mode), I got this error message:
Database Error: FRED library error: 'Internal Server Error' in "FETCH DGS10" on line 82.

The third time I attempted to run it this morning (in Verbose mode), I got this error message:
Database Error: FRED library error: 'Internal Server Error' in "FETCH WGS3MO" on line 98.

The fourth time I attempted to run it this morning (in Verbose mode), I got this error message:
Database Error: FRED library error: 'Internal Server Error' in "FETCH WGS7YR" on line 98.

After these 4 failures, I launched a new instance of EViews 14, opened a new program window, copy/pasted the above program into it, and attempted to process in Quiet mode. And I got this error message:
Database Error: FRED library error: 'Internal Server Error' in "FETCH DGS1" on line 82.

Then I attempted the program in Verbose mode, and got this error message:
Database Error: FRED library error: 'Internal Server Error' in "FETCH LNS13026511" on line 115.

In general, this "Database Error: FRED library error: 'Internal Server Error' in ..." seems to occur randomly, and doesn't appear to be associated to any one FRED ticker or any single line in the program. I don't know what's going on with it. This has been occurring for a couple weeks now. Prior to this program (which loops through a text file containing FRED tickers), I had a program similar to your test instance which called each periodicity (daily, weekly, monthly, etc.) in one big FETCH statement, like this:

dbopen(type=fred)
pageselect daily_data
fetch dgs1mo dgs3mo dgs6mo dgs1 dgs2 dgs3 dgs5 dgs7 dgs10 dgs20 dgs30 dtb4wk dcoilbrenteu dcoilwtico dff
pageselect weekly_data
fetch wgs1mo wgs3mo wgs6mo wgs1yr wgs2yr wgs3yr wgs5yr wgs7yr wgs10yr wgs20yr wgs30yr icsa icnsa cc4wsa ic4wsa ccnsa ccsa wtb4wk wcoilbrenteu wcoilwtico ff wei

so on and so forth, but it, too, is randomly failing with the same type of error message.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13585
Joined: Tue Sep 16, 2008 5:38 pm

Re: Database Error: FRED library error: 'Internal Server Error' in "FETCH ..."

Postby EViews Gareth » Thu Apr 09, 2026 10:21 am

text file uploads didn't come though (that might be on our end - some server maintenance has disabled file uploads for the forum at the moment).

But I think perhaps you're just hitting FRED too quickly in succession. Try putting some sleep commands in to slow down the hits.

rod_jensen
Posts: 9
Joined: Sat Jan 15, 2011 1:40 pm

Re: Database Error: FRED library error: 'Internal Server Error' in "FETCH ..."

Postby rod_jensen » Thu Apr 09, 2026 1:00 pm

ok, I've tried adding sleep() as follows, but still got this error:

Database Error: FRED library error: 'Internal Server Error' in "FETCH CPIHOSNS" in MONTHLY_ECONOMIC_DATA_04072026.PRG on line 46.

Here's the list of FRED tickers in my "tickers_monthly.txt" file:
indpro
ipman
unratensa
unrate
gs1m
gs3m
gs6m
gs1
gs2
gs3
gs5
gs7
gs10
gs20
gs30
mcumfn
tcu
tb4wk
cpiaucns
cpiaucsl
cpilegns
cpilegsl
cpiulfsl
cpiulfns
cpilfesl
cpilfens
cusr0000sa0l2
cuur0000sa0l2
cuur0000sac
cusr0000sac
cpiengsl
cpiengns
cpiufdns
cpiufdsl
cuur0000saf11
cusr0000saf11
cuur0000setb01
cusr0000setb01
cusr0000sah21
cuur0000sah21
cpihossl
cpihosns
cpimedns
cpimedsl
cusr0000setb
cuur0000setb
cuur0000seta
cusr0000seta
cusr0000seta01
cuur0000seta01
cusr0000san
cuur0000san
cusr0000saf115
cuur0000saf115
cuur0000sefv05
cusr0000sefv05
cuur0000seft
cusr0000seft
cusr0000sefv
cuur0000sefv
cuur0000sas
cusr0000sas
cusr0000sah1
cuur0000sah1
cpitrnns
cpitrnsl
cuur0000seta02
cusr0000seta02
mcoilbrenteu
mcoilwtico
dspi
a229rc0
fedfunds
jtshil
businv
isratio
lnu03023706
lns13023706
lnu03023622
lns13023622
lnu03026511
lns13026511
lnu03023654
lns13023654
ppiaco
PAYEMS
USPRIV
USGOOD
DMANEMP
NDMANEMP
CES0800000001
USMINE
USCONS
MANEMP
USWTRADE
USTRADE
CES4300000001
CES4422000001
USINFO
USFIRE
USPBS
USEHS
USLAH
USSERV
USGOVT
M1SL
M2SL
CURRCIR
CE16OV
UNEMPLOY
CLF16OV
PCEPI
PCEPILFE
CPIFABSL
CPIHOSSL
CPIAPPSL
CPITRNSL
CPIMEDSL
CPIRECSL
CPIEDUSL
CPIOGSSL
PCEC96
PPIFIS
PPIDGS
PPIDSS
PPIDCS
HPIPONM226S
CUSR0000SAC
CUSR0000SAS
DSERRG3M086SBEA
DGDSRG3M086SBEA

And here's a program which attempts to only load the monthly tickers from the tickers_monthly.txt file:

' Create the workfile container (no dated page yet)
wfcreate(wf=Economic_Data_0402026) u 1

' Create data page per data periodicity (monthly)
pagecreate(page=monthly_data) m 1919m1 2026m12

' Create an undated page for ticker import
pagecreate(page=monthly_tickers_page) u 5000

' Switch to the undated ticker page
pageselect monthly_tickers_page

' Import the monthly ticker list as alpha
%file = "C:\Temp\tickers_monthly.txt"
import(type=txt, colhead=none, name=series01, format=alpha) {%file}
rename series01 monthly_series

' This next section loops through each ticker series, fetches FRED time-series data per ticker, then places the data onto the associated data page
' Open FRED once
dbopen(type=fred)

' MONTHLY TICKERS
' Loop through the monthly tickers
for !i = 1 to 5000
' Go to monthly tickers page and read the i-th ticker
pageselect monthly_tickers_page
%ticker = monthly_series(!i)
if %ticker = "" then
exitloop
endif

' Go to monthly data page and fetch that ticker
pageselect monthly_data
fetch {%ticker}

' Include a sleep() statement
sleep(2000) ' 2 second pause
next

pageselect monthly_data

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13585
Joined: Tue Sep 16, 2008 5:38 pm

Re: Database Error: FRED library error: 'Internal Server Error' in "FETCH ..."

Postby EViews Gareth » Thu Apr 09, 2026 2:16 pm

Yep, we were able to replicate the error. Unfortunately it seems like it is an error on FRED's side. The internal server error is from their servers.

I wrote a python script that fetches the same series from FRED using their API, and occasionally get the exact same errors. It isn't an EViews issue, rather a FRED server stability issue.

Which, unfortunately, means there isn't a lot we can do about it on this end :/

rod_jensen
Posts: 9
Joined: Sat Jan 15, 2011 1:40 pm

Re: Database Error: FRED library error: 'Internal Server Error' in "FETCH ..."

Postby rod_jensen » Thu Apr 09, 2026 3:01 pm

ok, cool! Thanks a million Gareth, again. I have an email into the FRED team at the St. Louis Fed about the issue.

But, using Google Gemini AI, I've managed to get this revised version to process a couple times without stopping:

' Create the workfile container (no dated page yet)
wfcreate(wf=Economic_Data_0402026) u 1

' Create data page per data periodicity (monthly)
pagecreate(page=monthly_data) m 1919m1 2026m12

' Create an undated page for ticker import
pagecreate(page=monthly_tickers_page) u 5000

' Switch to the undated ticker page
pageselect monthly_tickers_page

' Import the monthly ticker list as alpha
%file = "C:\Rod_Investments\EViews_Programs\tickers_monthly.txt"
import(type=txt, colhead=none, name=series01, format=alpha) {%file}
rename series01 monthly_series

' This next section loops through each ticker series, fetches FRED time-series data per ticker, then places the data onto the associated data page
' Open FRED once
dbopen(type=fred)

' MONTHLY TICKERS
' Loop through the monthly tickers

' 1. Tell EViews to handle errors silently and not to stop
logmode +error ' Directs errors to the log window instead of a popup dialog
setmaxerrs 1000

for !i = 1 to 5000
pageselect monthly_tickers_page
%ticker = monthly_series(!i)
if %ticker = "" then
exitloop
endif

pageselect monthly_data

' 2. Start the Retry Logic
!success = 0
!tries = 0
while !success = 0 and !tries < 3
clearerrs ' Resets the @errorcount to 0
fetch(d=fred) {%ticker}

if @errorcount = 0 then
!success = 1
else
!tries = !tries + 1
sleep(5000)
endif
wend
sleep(1000)
next

' 5. Restore normal error reporting
logmode -error

And here are the contents of the log file:
Database Error: FRED library error: 'Internal Server Error' in "FETCH(D=FRED) GS5" in TEST_MONTHLY_FETCH_04092026.PRG on line 45.
Database Error: FRED library error: 'Internal Server Error' in "FETCH(D=FRED) CUUR0000SA0L2" in TEST_MONTHLY_FETCH_04092026.PRG on line 45.
Database Error: FRED library error: 'Internal Server Error' in "FETCH(D=FRED) CPIHOSNS" in TEST_MONTHLY_FETCH_04092026.PRG on line 45.
Database Error: FRED library error: 'Internal Server Error' in "FETCH(D=FRED) USPBS" in TEST_MONTHLY_FETCH_04092026.PRG on line 45.
Database Error: FRED library error: 'Internal Server Error' in "FETCH(D=FRED) CPIHOSSL" in TEST_MONTHLY_FETCH_04092026.PRG on line 45.

So, definitely, this is a FRED server(s) error.

I think I've asked you this before, and if I remember right, you said there isn't an EViews command to close the FRED database. Is this still the case with version 14?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13585
Joined: Tue Sep 16, 2008 5:38 pm

Re: Database Error: FRED library error: 'Internal Server Error' in "FETCH ..."

Postby EViews Gareth » Fri Apr 10, 2026 7:32 am

Code: Select all

close @db
will close any open database windows

rod_jensen
Posts: 9
Joined: Sat Jan 15, 2011 1:40 pm

Re: Database Error: FRED library error: 'Internal Server Error' in "FETCH ..."

Postby rod_jensen » Fri Apr 10, 2026 8:28 am

Thanks very much, Gareth!

capuchin
Posts: 36
Joined: Tue Oct 15, 2019 9:06 am

Re: Database Error: FRED library error: 'Internal Server Error' in "FETCH ..."

Postby capuchin » Mon Apr 27, 2026 12:37 pm

It seems to help to put each individual fetch on its own line of code instead of looping a fetch command, but it's a real nightmare.

I guess now I need to add 20 lines of code to each FRED fetch command in order to not fail! Thanks for the lines.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests