How to tackle the following? Please don't say \def cs{…}', say \def\cs{…}'. I've inserted an inaccessible control sequence

I am writing a text using EngC template (Cambridge Univ. Press). Main text looks ok, but I am getting a number of errors related to references part. Any suggestions on how to tackle it?

 \NeedsTeXFormat{LaTeX2e}[1996/06/01]

\documentclass{EngC}
\newcommand\cambridge{EngC}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{makeidx}
\usepackage{pgfplots}
\usepackage{filecontents}
\usepgfplotslibrary{patchplots}
\usepgfplotslibrary{colormaps} %
%\usepgfplotslibrary{external}
%\tikzexternalize
\usepackage{rotating} %sideway table
\usepackage{float}
\usepackage{amssymb}
\usepackage[numbers,compress]{natbib}
\usepackage{amsmath}% if you are using this package,
% it must be loaded before amsthm.sty
\usepackage{amsthm}
\usepackage{subcaption}
\usepackage{txfonts}% times font (used to produce EngCguide.pdf)
% this package must be loaded after amsthm.sty
\usepackage{graphicx}
%\usepackage{IEEEtran.bst}
%  \usepackage[rightcaption,raggedright]{sidecap}% for side captions
% \usepackage{framed}         % for floatingboxes
\usepackage{soul}
%\usepackage{harvard}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{bm}
\usepackage{flexisym}
%\usepackage{flushend}
\usepackage{dsfont}
%\usepackage[landscape]{geometry}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows}
\usetikzlibrary{chains,shapes.multipart}
\usetikzlibrary{shapes}
\usetikzlibrary{automata}
\setlength{\jot}{7pt}
\usepackage{multirow}
\usepackage{latexsym}
\usepackage[utf8]{inputenc}

\usetikzlibrary{shapes.geometric,arrows}
\tikzstyle{startstop}=[ellipse, minimum width=0.5cm, minimum height=0.4cm, text centered, draw=black, fill=white!30]
\tikzstyle{io}=[trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=0.5cm, minimum height=0.2cm, text centered, draw=black, fill=white!30]
\tikzstyle{process}=[rectangle, minimum width=1.5cm, minimum height=0.75cm, text badly centered, draw=black, fill=white!30]
\tikzstyle{decision}=[diamond, minimum width=1cm, text width=0.5cm, minimum height=0.2cm, text centered, draw=black, fill=white!30]
\tikzstyle{arrow}=[thick,->,>=stealth]

%\usepackage[dvipsnames]{xcolor}
\definecolor {processblue}{cmyk}{0,0,0,7}
\definecolor{light-gray}{gray}{0.85}
\newtheorem{thm}{Theorem}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{cor}{Corollary}[thm]
\usepackage[usenames,dvipsnames]{pstricks}
%\newcommand{\BigO}[1]{\ensuremath{\operatorname{O}\bigl(#1\bigr)}}
%\usepackage[dvipsnames]{xcolor}
\usepackage{pgfplots}
\usetikzlibrary{shapes.multipart}

\newcommand{\bc}{,\penalty0 \;}
\newcommand{\balpha}{{\boldsymbol \alpha}}
\newcommand{\bPhi}{{\boldsymbol \Phi}}
\newcommand{\bphi}{{\boldsymbol \phi}}
\newcommand{\bzero}{{\boldsymbol 0}}
%\newcommand*{\grayemph}[1]{%
%\tikz[baseline=(X.base)] \node[rectangle, fill=light-gray, rounded corners, inner sep=1.8mm] (X) {#1};%
%}

% if you are using either vancouver.bst or IEEEtran.bst and wish to remove
% square braces in the reference list, uncomment the line below
%\removesquarebraces
%   \usepackage{amsmath}
\usepackage{rotating}
\usepackage{floatpag}
\rotfloatpagestyle{empty}

% indexes
% uncomment the relevant set of commands

% for a single index
% \usepackage{makeidx}
% \makeindex

% for multiple indexes using multind.sty
% \usepackage{multind}\ProvidesPackage{multind}
%\makeindex{authors}
%\makeindex{subject}

% for multiple indexes using index.sty
% \usepackage{index}
% \makeindex

% see chapter 3 for details
\theoremstyle{plain}% default
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem*{corollary}{Corollary}
\usepackage{amsfonts}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{condition}[theorem]{Condition}

\theoremstyle{remark}
\newtheorem{remark}{Remark}[chapter]
\newtheorem{notation}[remark]{Notation}
\newtheorem*{case}{Case}

\hyphenation{line-break line-breaks docu-ment triangle cambridge amsthdoc
cambridgemods baseline-skip author authors cambridgestyle en-vir-on-ment polar}

\setcounter{tocdepth}{2}% the toc normally lists sections;
% for the purposes of this document, this has been extended to subsections

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% \includeonly{chap2}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeindex
\begin{document}

%  \frontmatter
%  \maketitle
%\tableofcontents
%  \listoffigures
%\listoftables
%  \listoffloatingboxes
%  \listofcontributors
% \editedlistofcontributors
%  \include{notation}

\mainmatter

\author[Doctor X and Doctor Y]
{Doctor X\footnotemark
and Doctor Y\footnotemark}

\chapterauthor{Doctor X\footnotemark\
and Doctor Y\footnotemark}

\chapter{Cool Science}
\label{intro}
\section{Section 1}
text text text
\section{Section 2}
text text text
\section{conclusions}
\bibliographystyle{IEEEtran} % uncomment for IEEE style
%\renewcommand{\refname}{Bibliography}% if you prefer this heading

\bibliography{percolation.bib}

\printindex
\end{document}


some errors are (compiled with overleaf)

Missing control sequence inserted.

<inserted text>
\inaccessible
l.185

Please don't say \def cs{...}', say \def\cs{...}'.
I've inserted an inaccessible control sequence so that your
definition will be completed without mixing me up too badly.
You can recover graciously from this error, if you're
careful; see exercise 27.2 in The TeXbook.

<argument> ...ournal \@empty \let \@bib@Z@journal
\@bibibid@ }\endgroup
l.1107 \end{document}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

Argument of \@bibibid@ has an extra }.

<inserted text>
\par
l.1107 \end{document}

I've run across a }' that doesn't seem to match anything.
For example, \def\a#1{...}' and \a}' would produce
this error. If you simply proceed now, the \par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your }' was spurious, just type 2' and it will go away

• Any pointer to the document class? Are you really sure you want to load flexisym`? – egreg Aug 1 at 8:32
• As you have been told before, we really need an MWE in order to easily help you. The emphasis here is on minimal (as in don't include unnecessary packages) and working (as in don't use external files we don't have access to). – schtandard Aug 1 at 8:46
• also don't give a fragment of "some errors" that is impossible to debug, just show, in full the first error message (any later error messages are quite likely spurious as a result of recovering from the first error) – David Carlisle Aug 1 at 8:50
• @egreg EnC file can be found here bit.ly/31dh4q7 – sosruko Aug 1 at 19:11
• I tried your example with the provided class, but I get no error. – egreg Aug 1 at 21:43