What is the error in this latex code

I am not able to understand why I am getting an error on line 40, though I can see nothing wrong here. Please help. I understand this question may be withheld 'as it may not be useful to others'.

\documentclass[]{beamer}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{makeidx}
\usepackage{graphicx}
\author{}
\title{Upper GI bleeding}
\begin{document}
\begin{frame}
\maketitle
\end{frame}
%---------------------------------------------------------------------------------
\section*{Presentation of upper GI bleeding}
\begin{frame}{Presentation of upper gastrointestinal bleeding}
\begin{itemize}
\item hematemesis or melena
\item iron deficiency anemia
\end{itemize}
\begin{description}
\item[Hematemesis ] Vomiting containing fresh or altered blood
\item[Melena]  tarry black stool with offensive smell
\item[hematochezia] fresh blooding per rectum
\end{description}
\end{frame}
%--------------------------------------------------------------------------------------------------
\subsection{Hematemesis and melena}
\begin{frame}
\frametitle{Hematemesis or melena}
\begin{itemize}
\item Significant amount of bleeding required
\item blood is an irritant for GIT- vomited or will produce diarrhea
\item At least $500 ml$ of blood is required to produce melena.
\item Depending upon amount of bleeding, patient will have
\begin{itemize}
\item tachycardia,
\item tachycardia and postural hypotension
\item tachycardia, hypotension, and altered mentation
\end{itemize}
\end{itemize}
\end{frame}
%---------------------------------------------------------------------------
\subsection*{Iron deficiency anemia}
\begin{frame}
\frametitle {Iron deficiency anemia}
\begin{description}\item [Iron deficirncy anemia]
develops when the person bleeds slowly for a long period   .
\end{description}
\end{frame}
%----------------------------------------------------------------------------------
\section*{The primary management}
\subsection*{Airway, breathing and circulation}
\subsection*{blood products}
\subsection*{Specific Drugs}
\section*{Source Identification}
\subsection*{Upper gi endoscopy}
\subsection*{Angiography}
\subsection*{Imaging }
\subsection*{Surgery}
\section*{Treatment of source}
\subsection*{Endoscopic management}
\subsection*{Angiography}
\subsection*{Surgery}
\section*{Prognosis}
\end{document}

-
The subsection has no parent, because you have typed \section*{Presentation ...}. So either \subsection* or \section without *. –  egreg Jan 26 at 15:13
oh. Thanks. Did not get the meaning of parents , though latex did suggest it. I think learning to understand error messageis equally important. –  Vaibhav Jan 26 at 15:20

The code would be legal in another class, although it would not give the expected result because the subsection would be numbered “0.1” as the section number hasn't been stepped.

The problem is that \subsection, in beamer must be relative to an explicit section number. So you need \section{Presentation of upper GI bleeding} or avoid numbering altogether (\setcounter{secnumdepth}{0}).

-

The reason for the error is already explained by egreg's comment. Thus this answer adds a hint.

If you do not want to have numbered sections, then the numbering can be turned off by setting counter secnumdepth, e.g.:

\setcounter{secnumdepth}{0}


This has the advantage, that bookmarks are generated.

For faster updated of the bookmarks, I recommend adding package bookmark:

\documentclass{beamer}
\usepackage{bookmark}

-