diff --git a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message.properties b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message.properties
index 144ab7c9e0..0e3b36c9c0 100644
--- a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message.properties
+++ b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message.properties
@@ -202,6 +202,7 @@
 1260016=文件源ID与标识至少指定一个
 1260017=文件源[id={0}]不在业务/业务集下
 1260018=接入点响应异常,详情:{0}
+1260019=文件源code不可为空
 
 ##业务错误-文件Worker服务(job-file-worker)
 1262001=第三方文件源响应异常:ListBucket,详情:{0}
diff --git a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_en.properties b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_en.properties
index 6931ef844c..3fc88ef5df 100644
--- a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_en.properties
+++ b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_en.properties
@@ -202,6 +202,7 @@
 1260016=At least one of id/code required
 1260017=FileSource[id={0}] does not belong to specified business
 1260018=FileWorker response error, Detail:{0}
+1260019=File source code can not be empty
 
 ## Business error (job-file-worker)
 1262001=Third file source response error:ListBucket, Detail:{0}
diff --git a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_en_US.properties b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_en_US.properties
index 6931ef844c..3fc88ef5df 100644
--- a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_en_US.properties
+++ b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_en_US.properties
@@ -202,6 +202,7 @@
 1260016=At least one of id/code required
 1260017=FileSource[id={0}] does not belong to specified business
 1260018=FileWorker response error, Detail:{0}
+1260019=File source code can not be empty
 
 ## Business error (job-file-worker)
 1262001=Third file source response error:ListBucket, Detail:{0}
diff --git a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_zh.properties b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_zh.properties
index 144ab7c9e0..0e3b36c9c0 100644
--- a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_zh.properties
+++ b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_zh.properties
@@ -202,6 +202,7 @@
 1260016=文件源ID与标识至少指定一个
 1260017=文件源[id={0}]不在业务/业务集下
 1260018=接入点响应异常,详情:{0}
+1260019=文件源code不可为空
 
 ##业务错误-文件Worker服务(job-file-worker)
 1262001=第三方文件源响应异常:ListBucket,详情:{0}
diff --git a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_zh_CN.properties b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_zh_CN.properties
index 144ab7c9e0..0e3b36c9c0 100644
--- a/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_zh_CN.properties
+++ b/src/backend/commons/common-i18n/src/main/resources/i18n/exception/message_zh_CN.properties
@@ -202,6 +202,7 @@
 1260016=文件源ID与标识至少指定一个
 1260017=文件源[id={0}]不在业务/业务集下
 1260018=接入点响应异常,详情:{0}
+1260019=文件源code不可为空
 
 ##业务错误-文件Worker服务(job-file-worker)
 1262001=第三方文件源响应异常:ListBucket,详情:{0}
diff --git a/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/exception/handler/EsbExceptionControllerAdvice.java b/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/exception/handler/EsbExceptionControllerAdvice.java
index 0b9b0631b3..716b80febc 100644
--- a/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/exception/handler/EsbExceptionControllerAdvice.java
+++ b/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/exception/handler/EsbExceptionControllerAdvice.java
@@ -32,6 +32,7 @@
 import com.tencent.bk.job.common.exception.FailedPreconditionException;
 import com.tencent.bk.job.common.exception.InternalException;
 import com.tencent.bk.job.common.exception.InvalidParamException;
+import com.tencent.bk.job.common.exception.MissingParameterException;
 import com.tencent.bk.job.common.exception.NotFoundException;
 import com.tencent.bk.job.common.exception.ResourceExhaustedException;
 import com.tencent.bk.job.common.exception.ServiceException;
@@ -160,6 +161,15 @@ ResponseEntity<?> handleUnauthenticatedException(HttpServletRequest request, Una
         return new ResponseEntity<>(EsbResp.buildCommonFailResp(ex), HttpStatus.OK);
     }
 
+    @ExceptionHandler({MissingParameterException.class})
+    @ResponseBody
+    ResponseEntity<?> handleMissingParameterException (HttpServletRequest request,
+                                                       MissingParameterException ex) {
+        String errorMsg = "Handle MissingParameterException , uri: " + request.getRequestURI();
+        log.warn(errorMsg, ex);
+        return new ResponseEntity<>(EsbResp.buildCommonFailResp(ex), HttpStatus.BAD_REQUEST);
+    }
+
     @Override
     @SuppressWarnings("all")
     protected ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotValidException ex,
diff --git a/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/constant/ErrorCode.java b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/constant/ErrorCode.java
index 309a397bc4..a41e8cb1a4 100644
--- a/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/constant/ErrorCode.java
+++ b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/constant/ErrorCode.java
@@ -325,6 +325,8 @@ public class ErrorCode {
     public static final int FILE_SOURCE_ID_NOT_IN_BIZ = 1260017;
     // 接入点响应异常,详情:{0}
     public static final int FAIL_TO_REQUEST_FILE_WORKER_WITH_REASON = 1260018;
+    // 文件源code不可为空
+    public static final int FILE_SOURCE_CODE_CAN_NOT_BE_EMPTY = 1260019;
 
     // 文件网关 end
     // 文件代理 start
diff --git a/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/exception/MissingParameterException.java b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/exception/MissingParameterException.java
new file mode 100644
index 0000000000..684ce859d8
--- /dev/null
+++ b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/exception/MissingParameterException.java
@@ -0,0 +1,79 @@
+/*
+ * Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available.
+ *
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company.  All rights reserved.
+ *
+ * BK-JOB蓝鲸智云作业平台 is licensed under the MIT License.
+ *
+ * License for BK-JOB蓝鲸智云作业平台:
+ * --------------------------------------------------------------------
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
+ * the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+package com.tencent.bk.job.common.exception;
+
+import com.tencent.bk.job.common.model.ValidateResult;
+import com.tencent.bk.job.common.model.error.ErrorType;
+import lombok.Getter;
+import lombok.ToString;
+
+/**
+ * 请求参数为空异常
+ */
+@Getter
+@ToString
+public class MissingParameterException extends ServiceException {
+    public MissingParameterException(Integer errorCode) {
+        super(ErrorType.INVALID_PARAM, errorCode);
+    }
+
+    public MissingParameterException(Integer errorCode, Object[] errorParams) {
+        super(ErrorType.INVALID_PARAM, errorCode, errorParams);
+    }
+
+    public MissingParameterException(Integer errorCode, Object errorParam) {
+        super(ErrorType.INVALID_PARAM, errorCode, new Object[]{errorParam});
+    }
+
+    public MissingParameterException(String message, Integer errorCode) {
+        super(message, ErrorType.INVALID_PARAM, errorCode);
+    }
+
+    public MissingParameterException(String message, Integer errorCode, Object[] errorParams) {
+        super(message, ErrorType.INVALID_PARAM, errorCode, errorParams);
+    }
+
+    public MissingParameterException(Throwable cause, Integer errorCode) {
+        super(cause, ErrorType.INVALID_PARAM, errorCode);
+    }
+
+    public MissingParameterException(Throwable cause, Integer errorCode, Object[] errorParams) {
+        super(cause, ErrorType.INVALID_PARAM, errorCode, errorParams);
+    }
+
+    public MissingParameterException(String message, Throwable cause, Integer errorCode) {
+        super(message, cause, ErrorType.INVALID_PARAM, errorCode);
+    }
+
+    public MissingParameterException(String message, Throwable cause, Integer errorCode,
+                                     Object[] errorParams) {
+        super(message, cause, ErrorType.INVALID_PARAM, errorCode, errorParams);
+    }
+
+    public MissingParameterException(ValidateResult validateResult) {
+        super(ErrorType.INVALID_PARAM, validateResult.getErrorCode(), validateResult.getErrorParams());
+    }
+
+}
diff --git a/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/api/esb/EsbFileSourceV3ResourceImpl.java b/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/api/esb/EsbFileSourceV3ResourceImpl.java
index a8f3e14c10..79cf30d212 100644
--- a/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/api/esb/EsbFileSourceV3ResourceImpl.java
+++ b/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/api/esb/EsbFileSourceV3ResourceImpl.java
@@ -4,6 +4,7 @@
 import com.tencent.bk.job.common.esb.model.EsbResp;
 import com.tencent.bk.job.common.exception.FailedPreconditionException;
 import com.tencent.bk.job.common.exception.InvalidParamException;
+import com.tencent.bk.job.common.exception.MissingParameterException;
 import com.tencent.bk.job.common.iam.exception.PermissionDeniedException;
 import com.tencent.bk.job.common.iam.model.AuthResult;
 import com.tencent.bk.job.common.model.dto.AppResourceScope;
@@ -104,6 +105,9 @@ private void checkCreateParam(EsbCreateOrUpdateFileSourceV3Req req) {
     private Integer checkUpdateParamAndGetId(EsbCreateOrUpdateFileSourceV3Req req) {
         Long appId = req.getAppId();
         String code = req.getCode();
+        if (StringUtils.isBlank(code)) {
+            throw new MissingParameterException(ErrorCode.FILE_SOURCE_CODE_CAN_NOT_BE_EMPTY);
+        }
         Integer id = fileSourceService.getFileSourceIdByCode(appId, code);
         if (id == null) {
             throw new FailedPreconditionException(ErrorCode.FAIL_TO_FIND_FILE_SOURCE_BY_CODE, new String[]{code});
diff --git a/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/dao/filesource/impl/FileSourceDAOImpl.java b/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/dao/filesource/impl/FileSourceDAOImpl.java
index 40f4e485cc..8fd56fd1ee 100644
--- a/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/dao/filesource/impl/FileSourceDAOImpl.java
+++ b/src/backend/job-file-gateway/service-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/dao/filesource/impl/FileSourceDAOImpl.java
@@ -198,7 +198,9 @@ private void saveFileSourceShareInfo(DSLContext dslContext, Integer fileSourceId
     public int updateFileSource(DSLContext dslContext, FileSourceDTO fileSourceDTO) {
         val query = dslContext.update(defaultTable);
         var updateSetStep = query.set(defaultTable.APP_ID, fileSourceDTO.getAppId());
-        updateSetStep = updateSetStep.set(defaultTable.CODE, fileSourceDTO.getCode());
+        if (StringUtils.isNotBlank(fileSourceDTO.getCode())) {
+            updateSetStep = updateSetStep.set(defaultTable.CODE, fileSourceDTO.getCode());
+        }
         if (StringUtils.isNotBlank(fileSourceDTO.getAlias())) {
             updateSetStep = updateSetStep.set(defaultTable.ALIAS, fileSourceDTO.getAlias());
         }
@@ -490,22 +492,15 @@ public boolean existsFileSource(Long appId, Integer id) {
     @Override
     public Integer getFileSourceIdByCode(Long appId, String code) {
         List<Condition> conditions = new ArrayList<>();
-        if (appId != null) {
-            conditions.add(defaultTable.APP_ID.eq(appId));
-        }
-        if (code != null) {
-            conditions.add(defaultTable.CODE.eq(code));
-        }
+        conditions.add(defaultTable.APP_ID.eq(appId));
+        conditions.add(defaultTable.CODE.eq(code));
         val query = defaultContext.select(
             defaultTable.ID
         ).from(defaultTable)
             .where(conditions);
-        val result = query.fetch();
-        if (result.size() > 0) {
-            if (result.size() > 1) {
-                log.warn("{} records found when get id by code, use first one", result.size());
-            }
-            return result.get(0).get(defaultTable.ID);
+        val result = query.fetchOne();
+        if (result != null) {
+            return result.get(defaultTable.ID);
         }
         return null;
     }